Posted 10 years ago by John Smith
Version: 14.1.0601
Avatar

Hi all

i don't know whether this question already was placed here in the forum. I could't find that one.

Have to use WPF DataGrid for the project of mine. Looks like DataGrid doesnt have clean MVVM Friendly way of getting the list of selectedRows ?

I can data bind to

ItemsSource="{Binding StammGroups}"  SelectedItem="{Binding SelectedGroup, Mode=TwoWay}"

but this only shows the 1st selected row. Need to be able to get all selected rows.

Any hints to do it cleanly via MVVM ?

Comments (1)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi John,

Looking at the Microsoft API for DataGrid (we didn't write the control), I'm not sure that there is a way to get the selected rows.  It seems that they only track the current row that the focus is in, as you saw.  There is a SelectedCells property though and perhaps you could somehow use that to derive the rows.  But after looking at it in Reflector, I'm not sure it would raise any property changed notifications so that likely rules out updates from pure MVVM bindings.


Actipro Software Support

The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.