EventToCommand for the ListBox selectedItems

Dec 16, 2010 at 9:34 PM


I need to select multiple items from a ListBox. Since "SelectedItems is not a DependencyProperty", I have created a EventToCommand as given in the MVVM Light sample for the datagrid.

 <ListBox x:Name ="LeftListBox" Grid.Row="1" Grid.Column="1"  Width="100" HorizontalAlignment="Right" Height="250" SelectionMode="Extended"  ItemsSource="{Binding Path=LeftSearchFields}">
         <i:EventTrigger EventName="SelectionChanged">
          Command="{Binding LeftListSelectionChangedCommand, Mode=OneWay}"
          CommandParameter="{Binding SelectedItems, ElementName=LeftListBox}"


However, the Command parameter - "SelectedItems" doesnt seem to hold the selectedItems at all. Is there anything I am missing?




Dec 16, 2010 at 11:41 PM


In what platform?

In Silverlight, SelectedItems is not a dependency property, so bindings to that property are OneTime only. The binding is not updated when the value changes.