This is a migrated thread and some comments may be shown as answers.

How to set checkbox into column header?

3 Answers 1045 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Iron
Alexander asked on 13 Oct 2017, 07:19 AM

I need to set checkbox into GridView checkboxcolumn header to implement "Select all" functionallity.

In wpf DataGrid it was simple i could set HeaderColumnTemplate property in xaml and bind to a DataGrid ViewModel object property. Unfortuantly I could not find simillar property or a way to to implement the functionality i need.

3 Answers, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 17 Oct 2017, 12:53 PM
Hello Alexander,

Thank you for your interest in RadGridView control.

There is a working example in our GitHub repository which demonstrates this approach. The example demonstrates how to select all cells from a column by either clicking on its header or by using a checkbox in the header template.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Marcus
Top achievements
Rank 1
answered on 18 Apr 2018, 03:17 PM

Dear Dinko,

I had looked at your example in the GitHub repository but there the checkbox-handling is implemented in the code-behind file. Is there a solution with the use of data binding? Accessing data via

 

"{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}, Path=DataContext.IsCheckboxChecked}"

 

only works in debugger if you type it while the debug-session is running. After recompiling it fails.

Regards

Marcus

0
Dinko | Tech Support Engineer
Telerik team
answered on 23 Apr 2018, 12:59 PM
Hello Marcus,

Can you try binding to the DataContext of the AncestorType set to RadGridView, not the Window? 

What I can suggest you is to try the GridViewSelectColumn column which has a built-in checkbox in the header for select all functionality. You can read more about this column in our Select Column help article in our documentation.

Regards,
Dinko
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
Alexander
Top achievements
Rank 1
Iron
Answers by
Dinko | Tech Support Engineer
Telerik team
Marcus
Top achievements
Rank 1
Share this question
or