Hi to All,
I would like to add one checkbox to every group header, and the handle its click or change event. In the event I must know a)what is the state of the checkbox and b) for what group it belongs to.
Thanks in advance
One option to add a checkbox to every group header of a XamDataGrid is to merge the default styles for the XamDataGrid and copy the GroupByRecordPresenter style into your MainWindow.xaml. In the GroupByRecordPresenter style, there is a StackPanel with its Orientation set to Vertical. This StackPanel contains a ContentControl and a GroupBySummariesPresenter.
If you set that StackPanel’s Orientation to Vertical and add a CheckBox to it, you can handle the Click event of that CheckBox in the code-behind. In that click event, you can use Utilities.GetAncestorFromType to obtain the GroupByRecordPresenter that the CheckBox sits in. Then, you can obtain the group by calling GroupByRecordPresenter1.Description. To get the state of the CheckBox, you can check the IsChecked property of it.
I have attached a sample application to demonstrate the above. To help you find where to place the CheckBox, I have placed a signature reading DSE-ANDREW directly above the StackPanel.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewDeveloper Support Engineer IInfragistics Inc.www.infragistics.com/support
Thx, that was a 1st class support and great help.
I've just discovered, that there is one thing what I can not know how to do with these checkboxes.
When the user clicks on a checkbox, I need to clear the other checkboxes. However I can not figure out how to access the other checkboxes in the event.
Sorry for changing back this from Verified answer to not answer. It was is still 1st class support. However 10 days ago I've posted an additional question here about your solution, and maybe its green verified answer prevented the notification system to show it for you. (just a guess). For you convenience, here is my 10 days old question:
First of all, I apologize for the delay as I was unaware of your new query on this forum thread. I do have a possible solution for you now though.
To have all of the other CheckBoxes in a group of GroupByRecordPresenters uncheck after one has been checked, I would recommend looping through each GroupByRecord in the XamDataGrid.Records collection in the same CheckBox Click event that was handled before. After that, you can call GroupByRecordPresenter.FromRecord(CurrentGroupByRecordInLoop) to get the GroupByRecordPresenter from each record.
After retrieving the GroupByRecordPresenter, check if it is the same one as the first GroupByRecordPresenter in the event handler, and if it is not, use the Utilities class to get the CheckBox from the new GroupByRecordPresenter and set its IsChecked property to false.
I have attached an updated version of the original sample I sent you to demonstrate the above.