Disable clicking around checkbox in cell

3 posts, 0 answers
  1. Jon
    Jon avatar
    2 posts
    Member since:
    Oct 2011

    Posted 30 Jul 2012 Link to this post

    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. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 31 Jul 2012 Link to this post

    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.

  3. Jon
    Jon avatar
    2 posts
    Member since:
    Oct 2011

    Posted 31 Jul 2012 Link to this post

    I still want to be able to select the rows by clicking on them.  Can I do something like CanUserSelect on the cell level?
Back to Top