I have a RadGridView with select column and items that are binded to this grid have boolean field named IsChecked. I want to write binding that will check\uncheck checkbox in GridViewSelectColumn depending on item's IsChecked property value. I tried everything I found in google, but no luck.
Any help will be appreciated.
Thanks
5 Answers, 1 is accepted
Please note that this column is bound (TwoWay) to the IsSelected property of the rows. Is your IsChecked property bound to it as well?
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I am using this code to achieve required functionality :
<telerik:RadGridView.RowStyle>
<Style TargetType=
"telerik:GridViewRow"
>
<Setter Property=
"IsSelected"
Value=
"{Binding IsChecked}"
/>
</Style>
</telerik:RadGridView.RowStyle>
It works, but it only selects rows that are visible, i.e. if I have 20 rows in my grid, and only 5 of them are visible without scrolling down when window opens and I want to select 10 rows, only this 5 visible rows are selected. How can I work around this situation?
Thanks
Indeed the binding to IsSelected will not work for the not visible rows as they still do not exist.
I would suggest you to work with the SelectedItems collection of the GridView directly rather then relying on the IsSelected property of the GridViewRow. Do you think that such an approach could be applied to your scenario?
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I tried using SelectedItems collection but I have an exception saying that this property has no setter. How can I set this collection?
You could take a look at this forum thread showing how to bind the SelectedItems collection of the RadGridView to a property in your ViewModel.
Regards,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.