Apply style on GridViewCheckBox Column in RadGridView

7 posts, 1 answers
  1. Omri
    Omri avatar
    4 posts
    Member since:
    Nov 2012

    Posted 05 Feb 2013 Link to this post

    hello,

    we have a RadGridView with some CheckBox columns defines as follows:

    <telerik:RadGridView EditTriggers="CellClick" ItemsSource="{Binding Tickets">
        <telerik:RadGridView.Columns>
            <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsBooked}"/>
     <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsTaken}"/>
     <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsBusy}"/>
     <telerik:GridViewCheckBoxColumn DataMemberBinding="{Binding IsReady}"/>
        </telerik:RadGridView.Columns>
    </telerik:RadGridView>


    I want to enable edit of all those columns in a single click.
    I have managed to do so by setting each column with 

    AutoSelectOnEdit="True" EditTriggers="CellClick"


    However, when I try to apply them by style it doesnt work!

    my style is defined as follows:
    <Style TargetType="{x:Type telerik:GridViewCheckBoxColumn}">
        <Setter Property="AutoSelectOnEdit" Value="True"/>
        <Setter Property="EditTriggers" Value="CellClick"/>
    </Style>


    Please help!
    Thanks, 
    Omri.
  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 05 Feb 2013 Link to this post

    Hi Omri,

    Generally, columns are not visual elements and should not define styles for them.  

    Regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. Omri
    Omri avatar
    4 posts
    Member since:
    Nov 2012

    Posted 05 Feb 2013 Link to this post

    Hi Maya,

    Thank you for your answer. that is ok because as i mention I have found a workaround.
    However, does it apply to the cells of the grid as well?

    My entire purpose is to enter edit mode, change the value of the checkBox and exit edit mode all by a single click.

    I've tried defining an event MouseUp and exit the edit mode in the event handler but it didn't work (I guess for the same reason ...)

    Is there any other possible way to do that?

    Thanks you,
    Omri
  4. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 06 Feb 2013 Link to this post

    Hi Omri,

    I am a bit confused. Why do you need to handle events or create style, rather than setting the required properties directly to the column ?  

    Regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Omri
    Omri avatar
    4 posts
    Member since:
    Nov 2012

    Posted 06 Feb 2013 Link to this post

    I have no problem setting the required properties directly to the column, I just haven't found what I am looking for.

    I'll try to explain it a bit more clearly.
    I have RadGridView with multiple checkBox columns. 
    I want to enable the user to change the value of the checkBox AND exit the edit mode all in a single click.
    I have managed to enable changing of CheckBox in a single click by setting
    AutoSelectOnEdit="True" EditTriggers="CellClick"

    but that leaves the cell in edit mode, so its still not good enough.

    How can I achive that by properties or any other way? 

    Thanks,
    Omri
  6. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 06 Feb 2013 Link to this post

    Hi Omri,

    Could you take a look at this article for a reference ? Does the second suggested approach correspond to your requirements ?  

    Regards,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  7. Omri
    Omri avatar
    4 posts
    Member since:
    Nov 2012

    Posted 07 Feb 2013 Link to this post

    Yes. It helped me solve my problem!

    Thank you!
Back to Top