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

GridViewSelectColumn - Map A Checkbox To Boolean Property

1 Answer 309 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Barry
Top achievements
Rank 1
Barry asked on 24 Aug 2017, 12:32 PM

I'm just trying to do something that seemingly should be simple... trying to map individual checkboxes in a telerik:GridViewSelectColumn in a telerik:RadGridView to a corresponding Boolean property of an entity mapped for each individual row.

<telerik:RadGridView x:Name="MyGridView" ItemsSource="{Binding MyGridViewItems, Mode=TwoWay}" SelectionMode="Extended" AutoGenerateColumns="False">    
    <telerik:RadGridView.Columns>
<telerik:GridViewSelectColumn Name="MyCheckBoxColumn">
   <telerik:GridViewSelectColumn.CellTemplate>
<DataTemplate>
   <CheckBox Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewDataControl}}, Path=DataContext.IncludeChangedCommand}" CommandParameter="{Binding}" IsChecked="{Binding MyBooleanProperty, Mode=TwoWay}" />
</DataTemplate>
   </telerik:GridViewSelectColumn.CellTemplate>                                            
</telerik:GridViewSelectColumn>

.
.
.

    </telerik:RadGridView.Columns>
</telerik:RadGridView>

 

How do I map MyBooleanProperty in each row/entity to each individual checkbox represented in the Grid?

1 Answer, 1 is accepted

Sort by
0
Dinko | Tech Support Engineer
Telerik team
answered on 29 Aug 2017, 10:54 AM
Hello Barry,

Thank you for contacting us.

You can take a look at the Binding SelectedItems From ViewModel SDK example in our GitHub repository which demonstrates how to implement a custom attached behavior in order to bind SelectedItems from and to your ViewModel.

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
Barry
Top achievements
Rank 1
Answers by
Dinko | Tech Support Engineer
Telerik team
Share this question
or