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

Disable clicking around checkbox in cell

2 Answers 71 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 30 Jul 2012, 06:50 PM
I have a RadGridView with a cell that has a checkbox in it.  This is defined using a DataTemplate like this:

        <DataTemplate x:Key="CheckBoxCellTemplate">
            <Grid 
                HorizontalAlignment="Stretch"
                VerticalAlignment="Stretch"
                <CheckBox 
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    Click="CheckBox_Click"
                    IsChecked="{Binding Path=IsSelected, Mode=TwoWay}" />
            </Grid>
        </DataTemplate>

        <telerik:GridViewDataColumn 
              CellTemplate="{StaticResource CheckBoxCellTemplate}">
        </telerik:GridViewDataColumn>

This functionality is designed to let the user click the checkboxes to select lots of rows (yeah, I know you can shift-click and ctrl-click to select rows).

The problem is that sometimes they want to check a bunch of checkboxes, but they barely miss the checkbox and click the cell area around the checkbox, which then selects that one row and unchecks all of their checkboxes.  Is there a way that I can either (a) expand the controls in the DataTemplate to take up all of the cell area or (b) prevent clicks in the cell area in a single column from causing the row to become selected?

2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 31 Jul 2012, 08:52 AM
Hi,

If you would like to select only by checking the CheckBoxes, the you could disable user selection on GridView level (with setting CanUserSelect ="False").

Kind regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Jon
Top achievements
Rank 1
answered on 31 Jul 2012, 11:50 AM
I still want to be able to select the rows by clicking on them.  Can I do something like CanUserSelect on the cell level?
Tags
GridView
Asked by
Jon
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Jon
Top achievements
Rank 1
Share this question
or