I am using a behavior for SelectedItems as directed by Infragistics. However, when the user Groups By a field in the XamDataGrid, SelectedItems always remains an empty collection, so none of my actions do anything. How can i resolve this? I saw SelectedItems was supposed to be done for 14.1 "Due in April". But it looks there there was only a service release instead, does that include SelectedItems binding? Attached is the behavior I am currently using to allow SelectedItems binding.
i included a sample project that shows the problem. first, selected some records and click the button. it will show the count of SelectedPeople. But then, group by Age and select some rows. The button then always shows Zero for SelectePeople count.
Hello Travis,
Thank you for your post.
I have been looking into the sample application you have provided. In the TransferSourceTarget method that is used to add the record into the collection, there is a check if the record is DataRecord and if the its ParentRecord if null. This is done to get onle data rows from the root band.
When you group by some field the ParentRecord is not null and the GroupByRecord is becoming the ParentRecord. This is way the record does pass the if clause and the record is not added to the collection.
What I can suggest is to remove the check for the ParentRecord or change the ParentRecord with ParentDataRecord. The ParentDataRecord shows if the record has a DataRecord as Parent (if the record is part of hierarchy).
Regarding your question about the SelectedItems property. There will be such property added for the XamDataGrid with the upcoming Volume Release for 14.1.
I have modified the sample application with the above mentioned functionality. Please find the application attached and feel free to let me know if you have any further questions on this matter.
The fix for 13.2 with the added behavior seems to work.
However, I upgraded to 14.1 in order to eliminate this added behavior. This SelectedDataItems property doesn't seem to work at all. I included modified the sample for 14.1 with SelectedDataItems="{Binding SelectedPeople}" and SelectedDataItemsScope="RecordsOnly". The show button always says there are two selected people, no matter what selection the user does in the grid. User interaction seems to do nothing. The sample browser and documentation is of no help. How does this new property work and how am i supposed to bind it to my view model?
I have been looking into your issue. The SelectedDataItems property is of type Object Array. More about the property you can find on the following link from our documentation: http://help.infragistics.com/Help/Doc/WPF/2014.1/CLR4.0/html/InfragisticsWPF4.DataPresenter.v14.1~Infragistics.Windows.DataPresenter.DataPresenterBase~SelectedDataItems.html.
I have modified the sample application you have provided in your previous post for you. I have added a ListBox, bound to the selected items, so they can be seen right after they were selected. I have also set the SelectionTypeRecord property to extended.
Please find the attached sample application and feel free to let me know if you have any further questions on this matter.
Ok thanks! How would i set selected items in code? For example, if the sample you sent, how can i have "John" and "Brenda" selected when the grid loads?