Hi,
I am looking for an MVVM friendly solution for binding the selected row's data item to the a ViewModel. I was thinking something similar to the XamDataGrid solution below.
<igDP:XamDataGrid>
<igDP:XamDataGrid.Resources>
<!-- To bind selection property to ViewModel Item -->
<Style x:Uid="Style_4" TargetType="{x:Type igDP:DataRecordCellArea}" BasedOn="{StaticResource DataRecordCellAreaQueryResStyle}">
<!-- To bind selection property to ViewModel Item !!!! -->
<Setter x:Uid="Setter_6" Property="IsSelected" Value="{Binding DataItem.IsSelected, Mode=TwoWay}"/>
</Style>
</igDP:XamDataGrid.Resources>
</igDP:XamDataGrid>
Any input is helpful!
Thanks,
-Peter
Hello Peter,
Thank you for your post. I have been looking into it and I suggest you see this forum thread:
http://blogs.infragistics.com/forums/p/28388/112945.aspx
where a similar thing is discussed.
Feel free to write me if you have further questions.
Hi Stefan,
Thank your for the link, now I understand the underlying issue. Do you have any suggestions how I should go about this? What's the original intended use? Just listen to the selected rows collection's events?
Hello again,
My suggestion is to see this blog:
http://blogs.infragistics.com/blogs/devin_rader/archive/2011/06/01/using-behaviors-to-synchronize-selected-items-of-infragistics-silverlight-controls-to-a-viewmodel.aspx
where it is explained how to use the XamGrid’s SelectedItems collection. Also you can handle the SelectionChanged event and set your underlying object’s IsSelected Property.
Hope this helps you.
Hello.
The above link is very important and referenced from many threads. Unfortunately the link for the code sample provided on the bottom of the above article is broken. Can it be restored?
Regards, Jeff
Hello Jeff,
Thank you for your post. We will shortly either attach a sample here or we will update you with a working link, from where you will be able to download the sample.
Thank you for your patience.
Hi guys,
I've just came across this thread and the source code link from Devin Radar's blog post seems to work.