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

Header Checkbox set to null for GridViewSelectColumn

1 Answer 137 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ahmad
Top achievements
Rank 1
Ahmad asked on 13 Apr 2017, 09:51 AM
I add a GridViewSelectColumn to my RadGridView with follwing grid configs: 
SelectionUnit="FullRow"
SelectionMode="Extended"

the Header CheckBox is checked if all rows are selected and it is unchecked if there is any unselected row.
but; what I wanna is:
Header Checkbox is checked if all rows are selected.
it is unchecked if all rows are unselected.
it is null if some rows are selected.
there is any way to do that?
Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan Nenchev
Telerik team
answered on 18 Apr 2017, 07:25 AM
Hello Ahmad,

It would be hard to achieve the behavior by directly manipulating the default checkbox in the SelectColumn's header as it is internally bound. With this in mind, finding it and directly settings its value to null would not work for you.

You can use a GridViewCheckBox column instead which can be bound to a boolean property of your business object. You can add a custom header that contains a CheckBox element and manipulate it. You can subscribe to the SelectionChanged event of your RadGridView and check what is the number of selected items and directly set the IsChecked property of this CheckBox. You can also utilize its Checked and Unchecked events as well.

Regards,
Stefan Nenchev
Telerik by Progress
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
Ahmad
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Share this question
or