Try creating an IsSelected
property on each of your data items and binding ListBoxItem.IsSelected
to that property
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
</Style>
More Related Contents:
- Add n rectangles to canvas with MVVM in WPF
- WPF MVVM navigate views
- Set focus on TextBox in WPF from view model
- Why RelayCommand
- WPF Binding UI events to commands in ViewModel
- Select multiple items from a DataGrid in an MVVM WPF project
- Stop TabControl from recreating its children
- How to handle dependency injection in a WPF/MVVM application
- This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread [duplicate]
- ReSharper WPF error: “Cannot resolve symbol “MyVariable” due to unknown DataContext”
- ListBox items return string, when DataTemplate is Button
- Close Window from ViewModel [duplicate]
- MVVM Light 5.0: How to use the Navigation service
- Selecting a Textbox Item in a Listbox does not change the selected item of the listbox
- How to write a ViewModelBase in MVVM
- Binding an Image in WPF MVVM
- Cannot find source for binding with reference ‘RelativeSource FindAncestor’ [duplicate]
- Handling the window closing event with WPF / MVVM Light Toolkit
- WPF/MVVM – how to handle double-click on TreeViewItems in the ViewModel?
- WPF binding not updating the view
- Should I bind to ICollectionView or ObservableCollection
- Twoway-bind view’s DependencyProperty to viewmodel’s property?
- WPF: How to bind a command to the ListBoxItem using MVVM?
- Can I somehow temporarily disable WPF data binding changes?
- Accessing the ScrollViewer of a ListBox from C#
- ObservableCollection not updating View
- WPF loading spinner
- mvvm how to make a list view auto scroll to a new Item in a list view
- How to bind column header to property in ViewModel? (WPF MVVM)
- WPF + MVVM + RadioButton : How to handle binding with single property?