0

I have a simple ListBox with about 500 ListBox item. I have 2 comboboxes on one item.

My problem is: When I scroll down I lose all SelectedItem binding data.

I have tried to replace the Virtualizingstackpanel to Stackpanel, but than it eats all of my computer's RAM. So I need to get it work with Virtualizingstackpanel.

The question is: How can I bind selected items to Comboboxes they are on listboxItems?

the code:

<DataTemplate x:Key="MyViewTemplate6">
    <Grid Height="110" Width="480" Margin="10" >
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <ComboBox HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" ItemTemplate="{StaticResource TypeTemplate7}" ItemsSource="{Binding Types}" SelectedItem="{Binding Type, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
    </Grid>
</DataTemplate>

This is in my ItemTemplate in ListBox.

Emmanuel DURIN
  • 4,803
  • 2
  • 28
  • 53
  • Can you show your databindings? – Sinatr Oct 13 '15 at 12:40
  • You mean that when the user scrolls, the selectedItem is lost. Is your Type setter correctly called ? – Emmanuel DURIN Oct 13 '15 at 12:51
  • I mean when I scroll down and scroll up there are no selected items. But if I change VirtualizingStackPanel to StackPanel on ItemsPanel there is no problem with this. Only the performance is my problem with stackpanel. – Tigyi János Oct 13 '15 at 12:54
  • Could you provide enough code to replicate the problem? I don't understand what scrolling has to do with the issue as there is only a `ComboBox` in your question referenced. – WiredPrairie Oct 14 '15 at 10:33

0 Answers0