Changing background color of GridViewCheckBoxColumn

5 posts, 0 answers
  1. Andreas
    Andreas avatar
    2 posts
    Member since:
    Dec 2011

    Posted 23 Dec 2011 Link to this post

    Hi,

    I am working on a RadGridView with a GridViewCheckBoxColumn using the Expression_DarkTheme. I'm trying to modify the colors, which is working well for most of the colors. But i have some problems with the background of the checkbox. 
    In edit mode i can modify the color by setting the BulletDecoratot.Bullet background color

    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type CheckBox}">
                <BulletDecorator Background="Transparent" SnapsToDevicePixels="true">
                    <BulletDecorator.Bullet>
                        <Border x:Name="Border" 
                            Width="13" 
                            Height="13" 
                            CornerRadius="0" 
                            Background="White"
                            BorderThickness="1"
                            BorderBrush="#404040">
                            <Path 
                                Width="7" Height="7" 
                                x:Name="CheckMark"
                                SnapsToDevicePixels="False" 
                                Stroke="#404040"
                                StrokeThickness="2"
                                Data="M 0 0 L 7 7 M 0 7 L 7 0" />
                        </Border>
                    </BulletDecorator.Bullet  
                </BulletDecorator>
                <ControlTemplate.Triggers>
                    <Trigger Property="HasContent" Value="true">
                        <Setter Property="FocusVisualStyle" Value="{StaticResource CheckRadioFocusVisual}"/>
                        <Setter Property="Padding" Value="4,0,0,0"/>
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="false">
                        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>

    But i'm not able to change the color to white outside of the edit mode.

    Can you please give me a hint?

    Thanks
    Andreas
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 23 Dec 2011 Link to this post

    Hi,

     
    GridViewCheckBoxColumn uses a GridViewCheckBox in non-edit mode and the standard CheckBox in edit mode. In our public forums you may find a discussion where this topic has been already discussed, following this link. The same approach is applicable to WPF as well. 
     


    All the best,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. Andreas
    Andreas avatar
    2 posts
    Member since:
    Dec 2011

    Posted 23 Dec 2011 Link to this post

    Hi Vanya Pavlova

    thanks for your quick response. This realy helped me a lot.

    Many Thanks!
  4. Ankur
    Ankur avatar
    9 posts
    Member since:
    Aug 2012

    Posted 01 Mar 2013 Link to this post

    I have a GridViewCheckBoxColumn inside telerik GridView cell and it is getting enabled/disabled through binding.
    According to the requirement, checkbox cell's background color should be white if checkbox's enabled property is true and disabled if checkbox's enabled property is false. 

    Below is the Xaml code:-

    <telerik:RadGridView Style="{StaticResource GridViewStyleMaster}" RowStyle="{StaticResource GridViewRowStyleMaster}" ScrollViewer.HorizontalScrollBarVisibility="Disabled"  CanUserResizeColumns="True"  Width="auto"

              GridLinesVisibility="Vertical"  AutoGenerateColumns="False" RowIndicatorVisibility="Collapsed"   CanUserInsertRows="False" CanUserDeleteRows="False"  ShowColumnHeaders="False"  

             IsSynchronizedWithCurrentItem="True"   CanUserSortColumns="False"  RowDetailsTemplate="{StaticResource RowDetailsTemplate}"

             BeginningEdit="telerikGridEntryList_BeginningEdit" RowDetailsVisibilityMode="Visible"  CanUserReorderColumns="False" CanUserFreezeColumns="False" IsFilteringAllowed="False" ShowGroupPanel="False">

                <telerik:RadGridView.Columns>

                    <telerik:GridViewCheckBoxColumn AutoSelectOnEdit="True" IsEnabled="{Binding CanUncheck}"   EditTriggers="CellClick" DataMemberBinding="{Binding IsChecked}" Width="32" CellStyle="{StaticResource GridViewHeaderCellStyleCustomCentre}" >


    Thanks in Advance....
  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 01 Mar 2013 Link to this post

    Hello Ankur,

    The way to go would be the same as the one mentioned above - to edit the template of the element. Did you try this approach ? Did you have any troubles ?  

    Greetings,
    Maya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top