- I find GridViewCheckBoxColumn far too dull - the difference between checked and unchecked is not obvious enough when it's not active. Is there an easy way to punch it up?
- I'd like the functionality of GridViewSelectColumn, but from what I've been able to determine, it isn't really intended to be used with MVVM. The documentation says explicitly that "GridViewSelectColumn does not bind to data". Am I missing something?
Thanks!
Brad.
Hello Brad,
Regarding the first question, may I ask if it would be possible to share, which theme is used on your end? This way, I can review the GridViewCheckBoxColumn for this theme and its generated GridViewCheckBox instances when they are inactive.
For the second question, indeed, the GridViewSelectColumn does not support binding as its intended use is to allow the user to change the IsSelected property of the respectful GridViewRow.
However, we have an example named "Bound GridViewSelectColumn" in our SDK Samples Browser, which showcases how to mirror the behavior of the GridViewSelectColumn by using a GridViewCheckBox column and in a data-binding scenario.
The code of the example can also be reviewed here:
xaml-sdk/GridView/BoundSelectColumn at master · telerik/xaml-sdk · GitHub
Hello Brad,
If no theme is specified explicitly on your end, then my guess is that the Xaml version of the assemblies is used and the default theme that comes from them is the Office_Black one. The following code snippet contains the default Style and ControlTemplate of the GridViewCheckBox element, which is the one that is displayed when the GridViewCheckBoxColumn column is in view mode (not currently edited):
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <!--Merge the Telerik.Windows.Controls.GridView generic resource dictionary to prevent the need to extract the resources used in the following code--> <ResourceDictionary Source="/Telerik.Windows.Controls.GridView;component/Themes/GenericOfficeBlack.xaml"/> </ResourceDictionary.MergedDictionaries> <ControlTemplate x:Key="GridViewCheckBoxTemplate" TargetType="telerik:GridViewCheckBox"> <Grid HorizontalAlignment="Left" VerticalAlignment="Center" Width="13" Height="13"> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="CheckStates"> <VisualState x:Name="Checked"> <Storyboard> <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0" Storyboard.TargetName="CheckedPath" Storyboard.TargetProperty="(UIElement.Visibility)"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> <VisualState x:Name="Unchecked"/> <VisualState x:Name="Indeterminate"> <Storyboard> <ObjectAnimationUsingKeyFrames BeginTime="0" Duration="0" Storyboard.TargetName="IndeterminatePath" Storyboard.TargetProperty="(UIElement.Visibility)"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <Visibility>Visible</Visibility> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Border x:Name="PART_RootElement" BorderBrush="#FF989898" BorderThickness="1"> <Border BorderBrush="#FFEEEEEE" BorderThickness="1"> <Border BorderThickness="1" Background="#FFE0E0E0" BorderBrush="#FFB9B9B9"> <Grid Margin="0"> <Path x:Name="IndeterminatePath" Visibility="Collapsed" Stretch="Fill" Stroke="#FF8D8D8D" Data="M14.708333,144.5 L20.667,144.5" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0" StrokeThickness="1.5" Width="7" Height="7"/> <Path x:Name="CheckedPath" Visibility="Collapsed" Stretch="Fill" Stroke="#FF8D8D8D" Data="M32.376187,77.162509 L35.056467,80.095277 40.075451,70.02144" StrokeThickness="1.5" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </Border> </Border> </Border> </Grid> </ControlTemplate> <Style x:Key="GridViewCheckBoxStyle" TargetType="telerik:GridViewCheckBox"> <Setter Property="Template" Value="{StaticResource GridViewCheckBoxTemplate}"/> </Style> <Style TargetType="telerik:GridViewCheckBox" BasedOn="{StaticResource GridViewCheckBoxStyle}"/> </ResourceDictionary> </Application.Resources>
If you would like to modify the check box that is displayed when a cell from the GridViewCheckBoxColumn is in edit mode, you could use the EditorStyle property and specify a Style that targets the native WPF CheckBox.
With this being said, I hope the provided information will be of help to you.
Hello Bradley,
Generally, the suggestion for extracting the default ControlTemplate of the GridViewCheckBox element is that all of the colors are hard-coded and cannot be changed by setting its BorderBrush and Background properties through a Style.
For your convenience, I have provided a sample project that contains the extracted ControlTemplate, and some of the elements are modified to showcase how to do it on your side. To test it, add the Xaml version of our assemblies that are required to use the RadGridView.
The example produces the following result:
Could you give it a try and let me know how it goes?