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

GridViewCheckBoxColumn CellTemplate Problem

1 Answer 221 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
ss asked on 14 Nov 2019, 03:16 PM
I want to display checkbox with text next to each other. But the solution below does not work. Only Checkbox is displayed. What is wrong?
<telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsChecked, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsReadOnlyBinding="{Binding Unavailable}" EditTriggers="CellClick"  Header="Check" Width="Auto">
                                    <DataTemplate DataType="{x:Type views:ItemList}">
                                            <CheckBox IsChecked="{Binding IsChecked}" IsEnabled="{Binding Unavailable, Converter={StaticResource InverseBooleanConverter}}" Command="{.....}, Path=Data}"
                                                    <TextBlock Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextAlignment="Right"></TextBlock>



1 Answer, 1 is accepted

Sort by
Dimitar Dinev
Telerik team
answered on 18 Nov 2019, 03:17 PM


Thank you for the code snippet.

The GridViewCheckBoxColumn doesn't support the CellTemplate attached property, since its expected to contain only a CheckBox.

One way to achieve the desired behavior is to replace the GridViewCheckBoxColumn with GridViewDataColumn and define the cell template you pointed.

Another approach would be to create a custom GridViewCheckBoxColumn and override its CreateCellElement and CreateCellEditElement methods. You can find more information in the Create Custom Column Editor article.

Attached, you can find a sample project which demonstrates the first approach. Please, review it and let me know if it delivered the desired result.

Dimitar Dinev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Asked by
Top achievements
Rank 1
Answers by
Dimitar Dinev
Telerik team
Share this question