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

Changing background color of GridViewCheckBoxColumn

4 Answers 353 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Andreas
Top achievements
Rank 1
Andreas asked on 23 Dec 2011, 10:36 AM
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

4 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 23 Dec 2011, 10:43 AM
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 >>

0
Andreas
Top achievements
Rank 1
answered on 23 Dec 2011, 11:21 AM
Hi Vanya Pavlova

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

Many Thanks!
0
Ankur
Top achievements
Rank 1
answered on 01 Mar 2013, 12:28 PM
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....
0
Maya
Telerik team
answered on 01 Mar 2013, 01:50 PM
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.

Tags
GridView
Asked by
Andreas
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Andreas
Top achievements
Rank 1
Ankur
Top achievements
Rank 1
Maya
Telerik team
Share this question
or