Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
725
How to add a checkbox to every group header? (and handle click/change event)
posted

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

Parents
  • 34830
    Verified Answer
    Offline posted

    Hello Justin,

    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,
    Andrew
    Developer Support Engineer I
    Infragistics Inc.
    www.infragistics.com/support

    XDGGroupHeaderCheckBoxCase.zip
Reply Children