Hello, I am really new to Infragistics and XamGrid...
I have a XamGrid whose ItemsSource is bound to an ObservableCollection. The ObservableCollection contains objects that have a property called IsSelected (type bool).
I want to do the following two things:
1) Create a style for the row so that when the row gets selected a property in its datacontext gets set. If I were using a ListoBox I would say:
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="IsSelected" Value="{Binding Path=IsSelected, Mode=TwoWay}"/> //Selected
</Style>
2) When the user doubleclicks on a row I want to execute an action (through an ICommand) defined in its DataContext (the object contained in the ObservableCollection).
This may be simple for most of you but I could really use the help.
Thanks in advance!
Hello Roberta,
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
I can suggest you see this blog:
http://social.technet.microsoft.com/wiki/contents/articles/18199.event-handling-in-an-mvvm-wpf-application.aspx
which explains how t o handle events in MVVM applications. Please let me know if you have further questions on this matter. Looking forward for your reply.
Stefan,
For the first issue I used the ActiveItem property of the xamgrid. I also found some samples that show you how to create a SelectedItems property for the xamgrid and those have been very helpful.
However I do not really have a solution for the second issue. I looked at your sample but it just uses code behind. I am trying to achieve my goal using the MVVM patter.
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Thank you for your post. I have been looking into it and I can say that the Row doesn’t have a visual representation. Basically there are CellControls in a CellControlPanel. This is why you are not able to bind the IsSelected Property. You can try to make something similar to Brian suggestion here:
http://es.infragistics.com/community/blogs/blagunas/archive/2012/07/16/xamgrid-data-bind-checkbox-in-row-selector.aspx
As for the double click, you can create a Style for the CellControl and handle its PreviewMouseDoubleClick event. I created a sample project for you showing how to do so. Please let me know if this helps you or you have further questions on this matter.
Looking forward for your reply.