Is there an easy way to disable user interface virtualization in a ListBox control? I am trying to find a control in a ListBox control using the "FindName ()" method, but if the control is explicitly disconnected from the web browser window, it does not find the control. I'm pretty sure the culprit is UI virtualization. Since the control scrolls from the page, it is no longer retrieved using "FindName ()".
Second, I scroll it back to the screen, it returns the control successfully.
This is a continuation of this question:
Silverlight: FrameworkElement.FindName () does not find the control when it is not "visible" in the browser window
Update with sample code
This is the code I'm trying to get the control from. "DynamicTagFormFields" is a ListBox control.
textField tf = DynamicTagFormFields.FindName(s.KeyValue) as textField;
This returns a valid textField if the actual textField control I am trying to retrieve is displayed to the end users on the screen. However, if I scroll the TextField control out of sight using the ListBox linear scrollbar, then run the process again, the above code will return null.
This is the XAML ListBox:
<ListBox x:Name="DynamicTagFormFields" Margin="0" Style="{StaticResource ListBoxStyle1}" ItemContainerStyle="{StaticResource ListBoxItemStyle4}" d:LayoutOverrides="Height" Grid.Row="2" IsTabStop="False" TabNavigation="Local" ScrollViewer.HorizontalScrollBarVisibility="Disabled"/>
The textField object is dynamically added to the ListBox programmatically with the following code:
DynamicTagFormFields.Items.Add(textFieldControl);
source share