We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to load DataTemplate in HeaderCell ?

GridDataControl allows you to load DataTemplate in the HeaderCell. You can load the DataTemplate in HeaderCell of GridDataControl by using HeaderCellTemplate property present in the GridDataControl’s VisibleColumns. You can load any control(s) within the DataTemplate.

The following code sample demonstrates how CheckBox is loaded inside HeaderCellsControl using DataTemplate.

XAML

CheckBoxClickBehavior

GridDataControl allows you to control the behavior of the checkBox column. Here the behavior of what should be done when clicking on the checkBox in the header cell is written using the click event of the checkBox in the CheckBoxClickBehavior class. The following code example illustrates how the checkBox column is designed to behave when clicked.

C#

 

In this example when the checkBox loaded inside the header cell is checked, then all the rows in that column will be automatically checked and vice versa. Whereas when you uncheck some of the rows in the IsChecked column by editing them, the checkBox in the header cell will go to intermediate state. This is achieved by handling the CurrentCellChanged event in GridDataControl. The following code sample shows how the state of the checkBox in the header cell is changed by handling the CurrentCellChanged event.

C#

 

The following screenshot shows the output for the above code in GridDataControl.

D:\Syncfusion\Issues\2014 Volume 2\KB Issues\KB Images\CheckBoxDataTemplateInHeaderCell.png

Article ID: Published Date: Last Revised Date: Platform: Control: .NET Framework: Product Version:
2421 08/06/2014 08/06/2014 WPF GridDataControl 4 12.1.0.43
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon