Silverlight combobox performance issue

I ran into a performance issue with an overflowing combobox (5000 items). Rendering a dropdown is very slow (as if it were calculating all the elements before showing any).

Do you have any trick to make this dropdown menu lazy?

Xaml Code:

  <Grid x:Name="LayoutRoot">
        <StackPanel Orientation="Horizontal" Width="200" Height="20">
            <TextBlock>Test Combo </TextBlock>
            <ComboBox x:Name="fooCombo" Margin="5,0,0,0"></ComboBox>
        </StackPanel>
    </Grid>

code behind:

public MainPage () {InitializeComponent ();

    List<string> li = new List<string>();

    int Max = 5000;
    for (int i = 0; i < Max; ++i)
        li.Add("Item - " + i);

    fooCombo.ItemsSource = li;
}

Something like a mistake in combobox user interface virtualization, so autocomplete should be a way.

+3
source share
2 answers

AutoCompleteBox, , , , , .

+2

, ComboBox ( AutoCompleteBox), , ItemsTemplate VirtualizingStackPanel. :

<ComboBox x:Name="fooCombo" Margin="5,0,0,0">
    <ComboBox.ItemsPanel>
        <ItemsPanelTemplate>
            <VirtualizingStackPanel></VirtualizingStackPanel>
        </ItemsPanelTemplate>
    </ComboBox.ItemsPanel>
</ComboBox>

, , , , , , ComboBox - 5000 .

, Silverlight, .

+6

Source: https://habr.com/ru/post/1749035/


All Articles