WPF Databind to read-only DataGrid.SelectedItems property

Thanks a million to the reference below:

I have spent one day looking for a MVVM solution to bind to DataGrid.SelectedItems property. WPF does not allow this because DataGrid.SelectedItems is read-only. However, I need to get hold of all selected items when performing “delete” action, or just to decide if a right-click menu item should appear or not, and I CAN’T!!!

After a day’s Googling and trying out millions of not-straightforward-and-ultimately-not-working ways, I have found the article above, which consists of 3 simple classes that just work! I would really like to share this with others who are having this trouble.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s