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

[Solved] Is it possible to set a GridViewCheckBoxColumn to behave like a GridViewSelectColumn?

4 Answers 147 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ernstjan
Top achievements
Rank 1
Ernstjan asked on 17 Jan 2011, 12:56 PM
Hi,

Currently I'm strugling a bit with a RadGridView that contains a lot of CheckBox columns, right now the user has to click at least two times to check a checkbox. I'd like to have a behavior like the GridViewSelectColumn (that means, one click is a check).

Anyone can help me with this?

Thanks in advance.

Ernstjan

4 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 17 Jan 2011, 12:57 PM
Hello Ernstjan,

You may try to set the IsReadOnly property of the column to "True".

Regards,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Ernstjan
Top achievements
Rank 1
answered on 17 Jan 2011, 01:02 PM
Hello Maya,

Thanks for your quick reply. I tried to set the checkboxcolumns to IsReadOnly="True", but now I cannot check the checkbox anymore.
Am I missing something?
0
Accepted
Maya
Telerik team
answered on 17 Jan 2011, 01:25 PM
Hi Ernstjan,

Please excuse me for the misunderstanding. If you want to use the GridViewCheckBoxColumn, you may define its properties EditTriggers to "CellClick" and AutoSelectOnEdit to "True":

<telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsPlaying,Mode=TwoWay}"
                                              EditTriggers="CellClick"                                                                                                                                            AutoSelectOnEdit="True"/>

In this case you will need a click for putting the cell into edit mode and a second one for checking the CheckBox. 
Another possible approach would be to use a GridViewDataColumn and define its CellTemplate as a CheckBox. In this way, however, will will bypass the built-in validation and you will need to handle it on your own:
<telerik:GridViewDataColumn>
  <telerik:GridViewDataColumn.CellTemplate>
       <DataTemplate>
             <CheckBox IsChecked="{Binding IsPlaying,Mode=TwoWay}" />
        </DataTemplate>
  </telerik:GridViewDataColumn.CellTemplate>
</telerik:GridViewDataColumn>


Regards,
Maya
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Ernstjan
Top achievements
Rank 1
answered on 17 Jan 2011, 02:27 PM
I used the CellTemplate approach and it does exactly what I want :)

Thanks a lot!

Tags
GridView
Asked by
Ernstjan
Top achievements
Rank 1
Answers by
Maya
Telerik team
Ernstjan
Top achievements
Rank 1
Share this question
or