3

Why the SelectedItems can't be bound from XAML ?!..how can I bind it keeping MVVM pattern applied ?

SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173
HichemSeeSharp
  • 3,240
  • 2
  • 22
  • 44
  • 2
    You should provide some simplified sample code for reference. Without some context, we cannot provide any solutions. – SliverNinja - MSFT Feb 09 '12 at 21:00
  • Please provide some sample code, to give us better idea of your problem – maridob Feb 09 '12 at 21:02
  • Does this answer your question? [Bind to SelectedItems from DataGrid or ListBox in MVVM](https://stackoverflow.com/questions/9880589/bind-to-selecteditems-from-datagrid-or-listbox-in-mvvm) – StayOnTarget Jul 20 '20 at 16:59

2 Answers2

2

SelectedItems is a read only property it can't be bound to. Although there exist ways around this with attached properties

thumbmunkeys
  • 20,606
  • 8
  • 62
  • 110
0

SelectedItems is read-only if you are trying to assign in.

If you are trying to read it, MVVM Light has a handy EventToCommand to relay the SelectedItems to your ViewModel

SliverNinja - MSFT
  • 31,051
  • 11
  • 110
  • 173