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

Foreground color of RadGridView not changing

12 Answers 708 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 05 Jun 2012, 08:11 PM
There is a lot of code in this post.  Please pardon the length.

I've got a RadGridView control that uses a custom StyleSelector.  There is a particular condition in my data which, when true, I want to flag by changing the color of the text to Red.  I also need the background color of the currently selected row (the entire row ) to change.  For some reason, however, the neither of these effects is working for me, though I did have the color changes working at one time.

I had to modify the template used by the RadGridView and GridViewRow classes in order to implement "day mode" and "night mode".  The idea is that the colors change to a darker scheme at night time and a brighter scheme during the day.  The app is to be used by police officers in patrol cars, so the color changes are important.

Here is the XAML in App.xaml for the RadGridView stuff:

<Style TargetType="{x:Type telerik:GridViewCell}">
     <Setter Property="BorderBrush" Value="{DynamicResource DataBorder}" />
     <Setter Property="Background"  Value="{DynamicResource DataBackground}" />
     <Setter Property="Foreground"  Value="{DynamicResource DataForeground}" />
 </Style>
   
 <Style TargetType="{x:Type telerik:GridViewRow}">
     <Setter Property="IsTabStop" Value="False"/>
     <Setter Property="Template">
         <Setter.Value>
             <ControlTemplate TargetType="{x:Type telerik:GridViewRow}">
                 <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
                     <VisualStateManager.VisualStateGroups>
                         <VisualStateGroup x:Name="FocusStates">
                             <VisualState x:Name="Unfocused"/>
                             <VisualState x:Name="Focused">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="NavigatorIndicator">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                         </VisualStateGroup>
                         <VisualStateGroup x:Name="SelectionStates">
                             <VisualState x:Name="Unselected"/>
                         </VisualStateGroup>
                         <VisualStateGroup x:Name="CommonStates">
                             <VisualState x:Name="Normal"/>
                             <VisualState x:Name="MouseOver">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Background_Over">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                             <VisualState x:Name="Selected">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Background_Selected">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="NavigatorIndicatorBackground">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                     <GradientStop Color="White" Offset="0"/>
                                                     <GradientStop Color="#FFE4E4E4" Offset="1"/>
                                                 </LinearGradientBrush>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                         </VisualStateGroup>
                         <VisualStateGroup x:Name="ValueStates">
                             <VisualState x:Name="RowValid"/>
                             <VisualState x:Name="RowInvalid">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Background_Invalid">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="ErrorIndicator">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                         </VisualStateGroup>
                         <VisualStateGroup x:Name="EditStates">
                             <VisualState x:Name="ReadOnlyMode"/>
                             <VisualState x:Name="EditMode">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="EditIndicator">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                         </VisualStateGroup>
                     </VisualStateManager.VisualStateGroups>
                     <telerik:SelectiveScrollingGrid x:Name="grid">
                         <telerik:SelectiveScrollingGrid.ColumnDefinitions>
                             <ColumnDefinition Width="Auto"/>
                             <ColumnDefinition Width="Auto"/>
                             <ColumnDefinition Width="Auto"/>
                             <ColumnDefinition Width="*"/>
                         </telerik:SelectiveScrollingGrid.ColumnDefinitions>
                         <telerik:SelectiveScrollingGrid.RowDefinitions>
                             <RowDefinition Height="*"/>
                             <RowDefinition Height="Auto"/>
                             <RowDefinition Height="Auto"/>
                             <RowDefinition Height="Auto"/>
                         </telerik:SelectiveScrollingGrid.RowDefinitions>
                         <Border x:Name="SelectionBackground" Background="{TemplateBinding Background}" Grid.ColumnSpan="2" Grid.Column="2" Margin="{TemplateBinding Margin}" Padding="{TemplateBinding Padding}" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                         <Border x:Name="Background_Over" BorderBrush="#FFFFC92B" BorderThickness="1" Grid.ColumnSpan="2" Grid.Column="2" CornerRadius="1" Margin="1,1,1,2" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True" Visibility="Collapsed">
                             <Border BorderBrush="White" BorderThickness="1">
                                 <Border.Background>
                                     <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                         <GradientStop Color="#FFFFFBA3" Offset="1"/>
                                         <GradientStop Color="#FFFFFBDA" Offset="0"/>
                                     </LinearGradientBrush>
                                 </Border.Background>
                             </Border>
                         </Border>
                         <Border x:Name="Background_Selected" BorderBrush="#FFFFC92B" BorderThickness="1" Grid.ColumnSpan="2" Grid.Column="2" CornerRadius="1" Margin="1,1,1,2" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True" Visibility="Collapsed">
                             <Border BorderBrush="White" BorderThickness="1">
                                 <Border.Background>
                                     <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                         <GradientStop Color="#FFFCE79F" Offset="1"/>
                                         <GradientStop Color="#FFFDD3A8"/>
                                     </LinearGradientBrush>
                                 </Border.Background>
                             </Border>
                         </Border>
                         <Border x:Name="Background_Invalid" BorderBrush="#FFCE7D7D" BorderThickness="1" Grid.ColumnSpan="2" Grid.Column="2" CornerRadius="1" Margin="1,1,1,2" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True" Visibility="Collapsed">
                             <Border BorderThickness="1">
                                 <Border.BorderBrush>
                                     <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                         <GradientStop Color="#FFEBF4FD"/>
                                         <GradientStop Color="#FFDBEAFD" Offset="1"/>
                                     </LinearGradientBrush>
                                 </Border.BorderBrush>
                                 <Border.Background>
                                     <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                         <GradientStop Color="#FFFCDCDC"/>
                                         <GradientStop Color="#FFFCC1C1" Offset="1"/>
                                     </LinearGradientBrush>
                                 </Border.Background>
                             </Border>
                         </Border>
                         <telerik:GridViewToggleButton x:Name="PART_HierarchyExpandButton" Grid.Column="2" IsHitTestVisible="{Binding IsExpandable, RelativeSource={RelativeSource TemplatedParent}}" IsTabStop="{TemplateBinding IsTabStop}" IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Width="25">
                             <telerik:GridViewToggleButton.Opacity>
                                 <Binding Path="IsExpandable" RelativeSource="{RelativeSource TemplatedParent}">
                                     <Binding.Converter>
                                         <telerik:BooleanToOpacityConverter/>
                                     </Binding.Converter>
                                 </Binding>
                             </telerik:GridViewToggleButton.Opacity>
                             <telerik:StyleManager.Theme>
                                 <telerik:Office_BlackTheme/>
                             </telerik:StyleManager.Theme>
                             <telerik:GridViewToggleButton.Template>
                                 <ControlTemplate TargetType="{x:Type telerik:GridViewToggleButton}">
                                     <Border Background="Transparent" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                                         <VisualStateManager.VisualStateGroups>
                                             <VisualStateGroup x:Name="CommonStates">
                                                 <VisualState x:Name="Normal"/>
                                                 <VisualState x:Name="MouseOver"/>
                                                 <VisualState x:Name="Disabled"/>
                                             </VisualStateGroup>
                                             <VisualStateGroup x:Name="CheckStates">
                                                 <VisualState x:Name="Checked">
                                                     <Storyboard>
                                                         <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="plus">
                                                             <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/>
                                                         </DoubleAnimationUsingKeyFrames>
                                                         <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="minus">
                                                             <DiscreteDoubleKeyFrame KeyTime="0" Value="1"/>
                                                         </DoubleAnimationUsingKeyFrames>
                                                     </Storyboard>
                                                 </VisualState>
                                                 <VisualState x:Name="Unchecked"/>
                                             </VisualStateGroup>
                                             <VisualStateGroup x:Name="FocusStates">
                                                 <VisualState x:Name="Focused"/>
                                                 <VisualState x:Name="Unfocused"/>
                                             </VisualStateGroup>
                                         </VisualStateManager.VisualStateGroups>
                                         <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Height="9" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Width="9">
                                             <Grid>
                                                 <Path x:Name="plus" Data="M1.937,0L2.937,0 2.937,2.0209999 5,2.0209999 5,3.0209999 2.937,3.0209999 2.937,5 1.937,5 1.937,3.0209999 0,3.0209999 0,2.0209999 1.937,2.0209999z" Fill="Black" Height="5" Margin="{TemplateBinding Padding}" Stretch="Fill" Stroke="{x:Null}" Width="5"/>
                                                 <Rectangle x:Name="minus" Fill="Black" HorizontalAlignment="Center" Height="1" Margin="{TemplateBinding Padding}" Opacity="0" RadiusY="0" RadiusX="0" Stroke="{x:Null}" VerticalAlignment="Center" Width="5"/>
                                             </Grid>
                                         </Border>
                                     </Border>
                                 </ControlTemplate>
                             </telerik:GridViewToggleButton.Template>
                             <telerik:GridViewToggleButton.Visibility>
                                 <Binding Path="HasHierarchy" RelativeSource="{RelativeSource TemplatedParent}">
                                     <Binding.Converter>
                                         <telerik:BooleanToVisibilityConverter/>
                                     </Binding.Converter>
                                 </Binding>
                             </telerik:GridViewToggleButton.Visibility>
                         </telerik:GridViewToggleButton>
                         <Border Grid.Column="2" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
                             <Border.Visibility>
                                 <Binding Path="HasHierarchy" RelativeSource="{RelativeSource TemplatedParent}">
                                     <Binding.Converter>
                                         <telerik:BooleanToVisibilityConverter/>
                                     </Binding.Converter>
                                 </Binding>
                             </Border.Visibility>
                         </Border>
                         <telerik:DataCellsPresenter x:Name="PART_DataCellsPresenter" Grid.Column="3" IsTabStop="False">
                             <telerik:StyleManager.Theme>
                                 <telerik:Office_BlackTheme/>
                             </telerik:StyleManager.Theme>
                         </telerik:DataCellsPresenter>
                         <Border x:Name="PART_RowBorder" BorderBrush="{TemplateBinding HorizontalGridLinesBrush}" Grid.ColumnSpan="4" Grid.Column="1" Grid.RowSpan="4" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True" VerticalAlignment="Bottom">
                             <Border.BorderThickness>
                                 <Binding ConverterParameter="Bottom" Path="HorizontalGridLinesWidth" RelativeSource="{RelativeSource TemplatedParent}">
                                     <Binding.Converter>
                                         <telerik:GridLineWidthToThicknessConverter/>
                                     </Binding.Converter>
                                 </Binding>
                             </Border.BorderThickness>
                         </Border>
                         <Border BorderBrush="#FF848484" BorderThickness="0,1" Background="#FFBBBBBB" Grid.ColumnSpan="2" Grid.Column="2" Padding="6" Grid.Row="2" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True">
                             <Border.Visibility>
                                 <Binding Path="IsExpanded" RelativeSource="{RelativeSource TemplatedParent}">
                                     <Binding.Converter>
                                         <telerik:BooleanToVisibilityConverter/>
                                     </Binding.Converter>
                                 </Binding>
                             </Border.Visibility>
                             <ContentPresenter x:Name="PART_HierarchyChildPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True"/>
                         </Border>
                         <telerik:DetailsPresenter x:Name="PART_DetailsPresenter" Grid.ColumnSpan="2" Grid.Column="2" DetailsProvider="{TemplateBinding DetailsProvider}" IsTabStop="False" Grid.Row="1" telerik:SelectiveScrollingGrid.SelectiveScrollingClip="True">
                             <telerik:StyleManager.Theme>
                                 <telerik:Office_BlackTheme/>
                             </telerik:StyleManager.Theme>
                         </telerik:DetailsPresenter>
                         <telerik:IndentPresenter x:Name="PART_IndentPresenter" Grid.Column="1" IsTabStop="False" IndentLevel="{TemplateBinding IndentLevel}" Grid.RowSpan="4" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical">
                             <telerik:StyleManager.Theme>
                                 <telerik:Office_BlackTheme/>
                             </telerik:StyleManager.Theme>
                         </telerik:IndentPresenter>
                         <Border x:Name="PART_IndicatorPresenter" BorderBrush="#FF848484" BorderThickness="0,0,1,1" Grid.Column="0" Grid.RowSpan="3" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{TemplateBinding RowIndicatorVisibility}" VerticalAlignment="Stretch" Width="25">
                             <Border x:Name="NavigatorIndicatorBackground" BorderBrush="White" BorderThickness="1" Background="#FFE4E4E4">
                                 <Grid>
                                     <Grid x:Name="NavigatorIndicator" HorizontalAlignment="Center" Height="11" Visibility="Collapsed" VerticalAlignment="Center" Width="11">
                                         <Path Data="F1M32.0234,6.66669L24.2923,0.0248413 28.3697,0.0248413 32,3.14362 36.1492,6.70819 32,10.2728 28.4664,13.3085 24.2923,13.3085 32.0234,6.66669z" Fill="#FF848484" HorizontalAlignment="Center" Height="8" Margin="0" Stretch="Fill" VerticalAlignment="Center" Width="8"/>
                                     </Grid>
                                     <Grid x:Name="EditIndicator" HorizontalAlignment="Center" Height="10" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
                                         <Path Data="M14,9L15,9 15,10 14,10z M1,9L2,9 2,10 1,10z M15,8L16,8 16,9 15,9z M0,8L1,8 1,9 0,9z M15,1L16,1 16,2 15,2z M0,1L1,1 1,2 0,2z M14,0L15,0 15,1 14,1z M1,0L2,0 2,1 1,1z" Fill="#7F848484" Stretch="Fill"/>
                                         <Path Data="M0.99999994,6.9999995L2,6.9999995 3,6.9999995 4,6.9999995 5,6.9999995 6,6.9999995 7,6.9999995 8,6.9999995 9,6.9999995 10,6.9999995 11,6.9999995 12,6.9999995 13,6.9999995 13,7.9999995 12,7.9999995 11,7.9999995 10,7.9999995 9,7.9999995 8,7.9999995 7,7.9999995 6,7.9999995 5,7.9999995 4,7.9999995 3,7.9999995 2,7.9999995 0.99999994,7.9999995z M13,0.99999994L14,0.99999994 14,1.9999999 14,2.9999995 14,3.9999995 14,4.9999995 14,5.9999995 14,6.9999995 13,6.9999995 13,5.9999995 13,4.9999995 13,3.9999995 13,2.9999995 13,1.9999999z M0,0.99999994L0.99999994,0.99999994 0.99999994,1.9999999 0.99999994,2.9999995 0.99999994,3.9999995 0.99999994,4.9999995 0.99999994,5.9999995 0.99999994,6.9999995 0,6.9999995 0,5.9999995 0,4.9999995 0,3.9999995 0,2.9999995 0,1.9999999z M11,0L12,0 13,0 13,0.99999994 12,0.99999994 11,0.99999994 10,0.99999994 9,0.99999994 8,0.99999994 7,0.99999994 6,0.99999994 5,0.99999994 4,0.99999994 3,0.99999994 2,0.99999994 0.99999994,0.99999994 0.99999994,2.3841858E-07 2,2.3841858E-07 3,2.3841858E-07 4,2.3841858E-07 5,2.3841858E-07 6,2.3841858E-07 7,2.3841858E-07 8,2.3841858E-07 9,2.3841858E-07 10,2.3841858E-07z" Fill="#FFCBCBCB" Margin="1" Stretch="Fill"/>
                                         <Path Data="M2,9L3,9 4,9 5,9 6,9 7,9 8,9 9,9 10,9 11,9 12,9 13,9 14,9 14,10 13,10 12,10 11,10 10,10 9,10 8,10 7,10 6,10 5,10 4,10 3,10 2,10z M14,8L15,8 15,9 14,9z M1,8L2,8 2,9 1,9z M15,2L16,2 16,3 16,4 16,5 16,6 16,7 16,8 15,8 15,7 15,6 15,5 15,4 15,3z M3,2L4,2 5,2 6,2 6,3 5,3 5,4 5,5 5,6 5,7 6,7 6,8 5,8 4,8 3,8 3,7 4,7 4,6 4,5 4,4 4,3 3,3z M0,2L1,2 1,3 1,4 1,5 1,6 1,7 1,8 0,8 0,7 0,6 0,5 0,4 0,3z M14,1L15,1 15,2 14,2z M1,1L2,1 2,2 1,2z M2,0L3,0 4,0 5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 13,0 14,0 14,1 13,1 12,1 11,1 10,1 9,1 8,1 7,1 6,1 5,1 4,1 3,1 2,1z" Fill="#FF848484" Stretch="Fill"/>
                                         <Path Data="M4,0L5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 12,1 12,2 12,3 12,4 12,5.0000001 12,6 11,6 10,6 9,6 8,6 7,6 6,6 5,6 4,6 4,5.0000001 3,5.0000001 3,4 3,3 3,2 3,1 4,1z M0,0L1,0 1,1 2,1 2,2 2,3 2,4 2,5.0000001 1,5.0000001 1,6 0,6 0,5.0000001 0,4 0,3 0,2 0,1z" Fill="White" Margin="2" Stretch="Fill"/>
                                     </Grid>
                                     <Grid x:Name="ErrorIndicator" HorizontalAlignment="Center" Height="16" Visibility="Collapsed" VerticalAlignment="Center" Width="16">
                                         <Grid.ToolTip>
                                             <ToolTip x:Name="validationTooltip" Content="{TemplateBinding Errors}" Placement="Bottom">
                                                 <ToolTip.Template>
                                                     <ControlTemplate TargetType="{x:Type ToolTip}">
                                                         <Grid x:Name="Root" Margin="5,0" Opacity="0" RenderTransformOrigin="0,0">
                                                             <Grid.RenderTransform>
                                                                 <TranslateTransform X="-25"/>
                                                             </Grid.RenderTransform>
                                                             <VisualStateManager.VisualStateGroups>
                                                                 <VisualStateGroup x:Name="OpenStates">
                                                                     <VisualStateGroup.Transitions>
                                                                         <VisualTransition From="{x:Null}" GeneratedDuration="0" GeneratedEasingFunction="{x:Null}" Storyboard="{x:Null}" To="{x:Null}"/>
                                                                         <VisualTransition From="{x:Null}" GeneratedDuration="0:0:0.2" GeneratedEasingFunction="{x:Null}" To="Open">
                                                                             <Storyboard>
                                                                                 <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
                                                                                     <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
                                                                                 </DoubleAnimationUsingKeyFrames>
                                                                                 <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root">
                                                                                     <SplineDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
                                                                                 </DoubleAnimationUsingKeyFrames>
                                                                             </Storyboard>
                                                                         </VisualTransition>
                                                                     </VisualStateGroup.Transitions>
                                                                     <VisualState x:Name="Closed">
                                                                         <Storyboard>
                                                                             <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root">
                                                                                 <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                                                                             </DoubleAnimationUsingKeyFrames>
                                                                         </Storyboard>
                                                                     </VisualState>
                                                                     <VisualState x:Name="Open">
                                                                         <Storyboard>
                                                                             <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="X" Storyboard.TargetName="xform">
                                                                                 <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                                                                             </DoubleAnimationUsingKeyFrames>
                                                                             <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Root">
                                                                                 <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                                                                             </DoubleAnimationUsingKeyFrames>
                                                                         </Storyboard>
                                                                     </VisualState>
                                                                 </VisualStateGroup>
                                                             </VisualStateManager.VisualStateGroups>
                                                             <Border Background="#052A2E31" CornerRadius="5" Margin="4,4,-4,-4"/>
                                                             <Border Background="#152A2E31" CornerRadius="4" Margin="3,3,-3,-3"/>
                                                             <Border Background="#252A2E31" CornerRadius="3" Margin="2,2,-2,-2"/>
                                                             <Border Background="#352A2E31" CornerRadius="2" Margin="1,1,-1,-1"/>
                                                             <Border Background="#FFDC000C" CornerRadius="2"/>
                                                             <Border CornerRadius="2">
                                                                 <ItemsControl>
                                                                     <ItemsControl.ItemsPanel>
                                                                         <ItemsPanelTemplate>
                                                                             <StackPanel IsItemsHost="True"/>
                                                                         </ItemsPanelTemplate>
                                                                     </ItemsControl.ItemsPanel>
                                                                     <ItemsControl.ItemTemplate>
                                                                         <DataTemplate>
                                                                             <TextBlock Foreground="White" MaxWidth="250" Margin="8,4" TextWrapping="Wrap" Text="{Binding}"/>
                                                                         </DataTemplate>
                                                                     </ItemsControl.ItemTemplate>
                                                                 </ItemsControl>
                                                             </Border>
                                                         </Grid>
                                                     </ControlTemplate>
                                                 </ToolTip.Template>
                                             </ToolTip>
                                         </Grid.ToolTip>
                                         <Path Data="M3,12.999999L4,12.999999 5,12.999999 6,12.999999 7,12.999999 8,12.999999 9,12.999999 10,12.999999 11,12.999999 11,13.999999 10,13.999999 9,13.999999 8,13.999999 7,13.999999 6,13.999999 5,13.999999 4,13.999999 3,13.999999z M11,11.999999L12,11.999999 12,12.999999 11,12.999999z M2.0000001,11.999999L3,11.999999 3,12.999999 2.0000001,12.999999z M12,10.999999L13,10.999999 13,11.999999 12,11.999999z M1,10.999999L2.0000001,10.999999 2.0000001,11.999999 1,11.999999z M13,2.9999992L14,2.9999992 14,3.9999992 14,4.9999992 14,5.9999992 14,6.9999992 14,7.9999992 14,8.9999992 14,9.9999992 14,10.999999 13,10.999999 13,9.9999992 13,8.9999992 13,7.9999992 13,6.9999992 13,5.9999992 13,4.9999992 13,3.9999992z M0,2.9999992L1,2.9999992 1,3.9999992 1,4.9999992 1,5.9999992 1,6.9999992 1,7.9999992 1,8.9999992 1,9.9999992 1,10.999999 0,10.999999 0,9.9999992 0,8.9999992 0,7.9999992 0,6.9999992 0,5.9999992 0,4.9999992 0,3.9999992z M12,1.9999999L13,1.9999999 13,2.9999992 12,2.9999992z M1,1.9999999L2.0000001,1.9999999 2.0000001,2.9999992 1,2.9999992z M11,0.99999994L12,0.99999994 12,1.9999999 11,1.9999999z M2.0000001,0.99999994L2.9999998,0.99999994 2.9999998,1.9999999 2.0000001,1.9999999z M2.9999998,0L3.9999998,0 5,0 6,0 7,0 8,0 9,0 10,0 11,0 11,0.99999994 10,0.99999994 9,0.99999994 8,0.99999994 7,0.99999994 6,0.99999994 5,0.99999994 3.9999998,0.99999994 2.9999998,0.99999994z" Margin="1" Stretch="Fill">
                                             <Path.Fill>
                                                 <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                     <GradientStop Color="#FFFC9999" Offset="0"/>
                                                     <GradientStop Color="#FFC26666" Offset="1"/>
                                                 </LinearGradientBrush>
                                             </Path.Fill>
                                         </Path>
                                         <Path Data="M1.4901161E-07,8L1.0000001,8 2.0000002,8 2.0000002,9 2.0000002,10 1.0000003,10 1.0000003,9 1.0000001,10 1.4901161E-07,10 1.4901161E-07,9z M1.4901161E-07,0L1.0000001,0 2.0000002,0 2.0000002,1 2.0000002,2 2.0000002,3 2.0000002,4.0000001 2.0000002,5 2.0000002,5.9999999 2.0000002,7 1.0000001,7 1.4901161E-07,7 1.4901161E-07,5.9999999 1.4901161E-07,5 1.4901161E-07,4.0000001 1.4901161E-07,3 1.4901161E-07,2 0,1z" Fill="White" Margin="7,3" Stretch="Fill"/>
                                         <Path Data="M4,15L5,15 6,15 7,15 8,15 9,15 10,15 11,15 12,15 12,16 11,16 10,16 9,16 8,16 7,16 6,16 5,16 4,16z M12,14L13,14 13,15 12,15z M3,14L4,14 4,15 3,15z M13,13L14,13 14,14 13,14z M2,13L3,13 3,14 2,14z M14,12L15,12 15,13 14,13z M1,12L2,12 2,13 1,13z M7,11L7,12 7,13 8,13 9,13 9,12 9,11 8,11z M15,4L16,4 16,5 16,6 16,7 16,8 16,9 16,10 16,11 16,12 15,12 15,11 15,10 15,9 15,8 15,7 15,6 15,5z M0,4L1,4 1,5 1,6 1,7 1,8 1,9 1,10 1,11 1,12 0,12 0,11 0,10 0,9 0,8 0,7 0,6 0,5z M14,3L15,3 15,4 14,4z M7,3L7,4 7,5 7,6 7,7 7,8 7,9 7,10 8,10 9,10 9,9 9,8 9,7 9,6 9,5 9,4 9,3 8,3z M1,3L2,3 2,4 1,4z M13,2L14,2 14,3 13,3z M4,2L5,2 6,2 7,2 8,2 9,2 10,2 11,2 12,2 12,3 13,3 13,4 14,4 14,5 14,6 14,7 14,8 14,9 14,10 14,11 14,12 13,12 13,13 12,13 12,14 11,14 10,14 9,14 8,14 7,14 6,14 5,14 4,14 4,13 3,13 3,12 2,12 2,11 2,10 2,9 2,8 2,7 2,6 2,5 2,4 3,4 3,3 4,3z M2,2L3,2 3,3 2,3z M12,1L13,1 13,2 12,2z M3,1L4,1 4,2 3,2z M4,0L5,0 6,0 7,0 8,0 9,0 10,0 11,0 12,0 12,1 11,1 10,1 9,1 8,1 7,1 6,1 5,1 4,1z" Stretch="Fill">
                                             <Path.Fill>
                                                 <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                                     <GradientStop Color="Red" Offset="0"/>
                                                     <GradientStop Color="#FF990000" Offset="1"/>
                                                 </LinearGradientBrush>
                                             </Path.Fill>
                                         </Path>
                                     </Grid>
                                     <Border x:Name="PART_RowResizer" Background="Transparent" Cursor="SizeNS" Height="2" VerticalAlignment="Bottom"/>
                                 </Grid>
                             </Border>
                         </Border>
                     </telerik:SelectiveScrollingGrid>
                 </Border>
             </ControlTemplate>
         </Setter.Value>
     </Setter>
     <Setter Property="Background"                 Value="White"/>
     <Setter Property="BorderBrush"                Value="#FFCBCBCB"/>
     <Setter Property="BorderThickness"            Value="0"/>
     <Setter Property="AllowDrop"                  Value="True"/>
     <Setter Property="FontWeight"                 Value="Normal"/>
     <Setter Property="VerticalContentAlignment"   Value="Stretch"/>
     <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
     <Setter Property="Padding"                    Value="0"/>
     <Setter Property="SnapsToDevicePixels"        Value="True"/>
 </Style>
 <Style TargetType="{x:Type telerik:DataCellsPresenter}">
     <Setter Property="Template">
         <Setter.Value>
             <ControlTemplate TargetType="{x:Type telerik:DataCellsPresenter}">
                 <Grid>
                     <ItemsPresenter />
                     <telerik:FrozenColumnsSplitter x:Name="PART_FrozenColumnsSplitter"
                                                    Cursor="None"
                                                    HorizontalAlignment="Left"
                                                    IsTabStop="False">
                         <telerik:StyleManager.Theme>
                             <telerik:Office_BlackTheme />
                         </telerik:StyleManager.Theme>
                     </telerik:FrozenColumnsSplitter>
                 </Grid>
             </ControlTemplate>
         </Setter.Value>
     </Setter>
     <Setter Property="IsTabStop" Value="False" />
     <Setter Property="ItemsPanel">
         <Setter.Value>
             <ItemsPanelTemplate>
                 <telerik:GridViewCellsPanel IsItemsHost="True" />
             </ItemsPanelTemplate>
         </Setter.Value>
     </Setter>
     <Setter Property="SnapsToDevicePixels" Value="True" />
     <Setter Property="BorderBrush"         Value="{DynamicResource DataBorder}" />
     <Setter Property="Foreground"          Value="{DynamicResource DataHeaderForeground}" />
 </Style>
   
 <Style TargetType="{x:Type telerik:RadGridView}">
     <Setter Property="Template">
         <Setter.Value>
             <ControlTemplate TargetType="{x:Type telerik:RadGridView}">
                 <Border x:Name="PART_MasterGridContainer"
                         BorderBrush="{TemplateBinding BorderBrush}"
                         BorderThickness="{TemplateBinding BorderThickness}"
                         Padding="{TemplateBinding Padding}">
                     <VisualStateManager.VisualStateGroups>
                         <VisualStateGroup x:Name="GridViewActivity">
                             <VisualState x:Name="Idle">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                                    Storyboard.TargetName="PART_GridViewLoadingIndicator">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Collapsed</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                             <VisualState x:Name="Busy">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                                    Storyboard.TargetName="PART_GridViewLoadingIndicator">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                         </VisualStateGroup>
                         <VisualStateGroup x:Name="ColumnHeadersVisibility">
                             <VisualState x:Name="ColumnHeadersVisible">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                                    Storyboard.TargetName="PART_HeaderRow">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                             <VisualState x:Name="ColumnHeadersCollapsed">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                                    Storyboard.TargetName="PART_HeaderRow">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Collapsed</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                         </VisualStateGroup>
                         <VisualStateGroup x:Name="ColumnFootersVisibility">
                             <VisualState x:Name="ColumnFootersVisible">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                                    Storyboard.TargetName="PART_FooterRow">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                             <VisualState x:Name="ColumnFootersCollapsed">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                                    Storyboard.TargetName="PART_FooterRow">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Collapsed</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                         </VisualStateGroup>
                         <VisualStateGroup x:Name="GroupPanelVisibility">
                             <VisualState x:Name="GroupPanelVisible">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                                    Storyboard.TargetName="PART_GroupPanel">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                             <VisualState x:Name="GroupPanelCollapsed">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                                    Storyboard.TargetName="PART_GroupPanel">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Collapsed</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                         </VisualStateGroup>
                         <VisualStateGroup x:Name="InsertRowVisibility">
                             <VisualState x:Name="InsertRowVisible">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                                    Storyboard.TargetName="PART_AddNewRow">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                             <VisualState x:Name="InsertRowCollapsed">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                                    Storyboard.TargetName="PART_AddNewRow">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Collapsed</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                         </VisualStateGroup>
                         <VisualStateGroup x:Name="DisabledStates">
                             <VisualState x:Name="Enabled" />
                             <VisualState x:Name="Disabled">
                                 <Storyboard>
                                     <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility"
                                                                    Storyboard.TargetName="Background_Disabled">
                                         <DiscreteObjectKeyFrame KeyTime="0">
                                             <DiscreteObjectKeyFrame.Value>
                                                 <Visibility>Visible</Visibility>
                                             </DiscreteObjectKeyFrame.Value>
                                         </DiscreteObjectKeyFrame>
                                     </ObjectAnimationUsingKeyFrames>
                                 </Storyboard>
                             </VisualState>
                         </VisualStateGroup>
                     </VisualStateManager.VisualStateGroups>
                     <Grid x:Name="HierrarchyBackground"
                           Background="{TemplateBinding Background}">
                         <Grid.ColumnDefinitions>
                             <ColumnDefinition />
                             <ColumnDefinition x:Name="ScrollBarColumn"
                                               MinWidth="0"
                                               Width="0" />
                         </Grid.ColumnDefinitions>
                         <Grid.RowDefinitions>
                             <RowDefinition Height="Auto" />
                             <RowDefinition x:Name="PART_AttachedBehaviorRow"
                                            Height="Auto" />
                             <RowDefinition />
                             <RowDefinition x:Name="ScrollBarRow"
                                            Height="0"
                                            MinHeight="0" />
                             <RowDefinition Height="Auto" />
                         </Grid.RowDefinitions>
                         <telerik:GridViewGroupPanel x:Name="PART_GroupPanel"
                                                     BorderBrush="#FF848484"
                                                     Background="{TemplateBinding GroupPanelBackground}"
                                                     Grid.ColumnSpan="2"
                                                     Foreground="{TemplateBinding GroupPanelForeground}"
                                                     IsTabStop="False"
                                                     Grid.Row="0">
                             <telerik:StyleManager.Theme>
                                 <telerik:Office_BlackTheme />
                             </telerik:StyleManager.Theme>
                         </telerik:GridViewGroupPanel>
                         <telerik:GridViewScrollViewer x:Name="PART_ItemsScrollViewer"
                                                       Background="Transparent"
                                                       CanContentScroll="True"
                                                       Grid.ColumnSpan="2"
                                                       Grid.Row="2"
                                                       Grid.RowSpan="2">
                             <telerik:GridViewScrollViewer.FooterRow>
                                 <telerik:GridViewFooterRow x:Name="PART_FooterRow"
                                                            IsTabStop="False"
                                                            IndentLevel="{TemplateBinding GroupCount}">
                                     <telerik:StyleManager.Theme>
                                         <telerik:Office_BlackTheme />
                                     </telerik:StyleManager.Theme>
                                 </telerik:GridViewFooterRow>
                             </telerik:GridViewScrollViewer.FooterRow>
                             <telerik:GridViewScrollViewer.HeaderRow>
                                 <telerik:GridViewHeaderRow x:Name="PART_HeaderRow"
                                                            IsTabStop="False"
                                                            IndentLevel="{TemplateBinding GroupCount}">
                                     <telerik:StyleManager.Theme>
                                         <telerik:Office_BlackTheme />
                                     </telerik:StyleManager.Theme>
                                 </telerik:GridViewHeaderRow>
                             </telerik:GridViewScrollViewer.HeaderRow>
                             <telerik:GridViewScrollViewer.NewRow>
                                 <telerik:GridViewNewRow x:Name="PART_AddNewRow"
                                                         IsTabStop="False"
                                                         IndentLevel="{TemplateBinding GroupCount}"
                                                         Visibility="Collapsed">
                                     <telerik:StyleManager.Theme>
                                         <telerik:Office_BlackTheme />
                                     </telerik:StyleManager.Theme>
                                 </telerik:GridViewNewRow>
                             </telerik:GridViewScrollViewer.NewRow>
                             <telerik:StyleManager.Theme>
                                 <telerik:Office_BlackTheme />
                             </telerik:StyleManager.Theme>
                             <telerik:GridViewVirtualizingPanel x:Name="PART_GridViewVirtualizingPanel" />
                         </telerik:GridViewScrollViewer>
                         <telerik:ScrollPositionIndicator x:Name="PART_ScrollPositionIndicator"
                                                          Grid.ColumnSpan="2"
                                                          ContentTemplate="{TemplateBinding ScrollPositionIndicatorTemplate}"
                                                          HorizontalAlignment="Right"
                                                          IsHitTestVisible="False"
                                                          IsTabStop="False"
                                                          Margin="0,0,28,0"
                                                          Grid.Row="2">
                             <telerik:StyleManager.Theme>
                                 <telerik:Office_BlackTheme />
                             </telerik:StyleManager.Theme>
                             <telerik:ScrollPositionIndicator.Visibility>
                                 <Binding Mode="TwoWay"
                                          Path="IsScrolling"
                                          RelativeSource="{RelativeSource TemplatedParent}">
                                     <Binding.Converter>
                                         <telerik:BooleanToVisibilityConverter />
                                     </Binding.Converter>
                                 </Binding>
                             </telerik:ScrollPositionIndicator.Visibility>
                         </telerik:ScrollPositionIndicator>
                         <Border x:Name="PART_FrozenColumnsPreview"
                                 Background="#33000000"
                                 HorizontalAlignment="Left"
                                 Grid.Row="1"
                                 Grid.RowSpan="4"
                                 Visibility="Collapsed"
                                 VerticalAlignment="Stretch"
                                 Width="6" />
                         <telerik:GridViewLoadingIndicator x:Name="PART_GridViewLoadingIndicator"
                                                           Grid.ColumnSpan="2"
                                                           IsTabStop="False"
                                                           IsBusy="{Binding IsBusy, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                                           Grid.RowSpan="4"
                                                           Visibility="Collapsed">
                             <telerik:StyleManager.Theme>
                                 <telerik:Office_BlackTheme />
                             </telerik:StyleManager.Theme>
                         </telerik:GridViewLoadingIndicator>
                         <Rectangle x:Name="Background_Disabled"
                                    Grid.ColumnSpan="2"
                                    IsHitTestVisible="False"
                                    Grid.RowSpan="5"
                                    Visibility="Collapsed">
                             <Rectangle.Fill>
                                 <LinearGradientBrush EndPoint="0.5,1"
                                                      StartPoint="0.5,0">
                                     <GradientStop Color="#E5000000" />
                                     <GradientStop Color="#E5000000"
                                                   Offset="1" />
                                     <GradientStop Color="#4C000000"
                                                   Offset="0.5" />
                                 </LinearGradientBrush>
                             </Rectangle.Fill>
                         </Rectangle>
                     </Grid>
                 </Border>
             </ControlTemplate>
         </Setter.Value>
     </Setter>
     <Setter Property="Background"                                 Value="{DynamicResource DataBackground}" />
     <Setter Property="BorderBrush"                                Value="{DynamicResource DataBorder}" />
     <Setter Property="Foreground"                                 Value="{DynamicResource DataForeground}" />
     <Setter Property="BorderThickness"                            Value="1" />
     <Setter Property="AlternateRowBackground"                     Value="{DynamicResource AlternatingRowBackground}" />
     <Setter Property="VerticalGridLinesBrush"                     Value="{DynamicResource DataGridLines}" />
     <Setter Property="HorizontalGridLinesBrush"                   Value="{DynamicResource DataGridLines}" />
     <Setter Property="GroupPanelBackground"                       Value="{DynamicResource DataHeaderBackground}"/>
     <Setter Property="GroupPanelForeground"                       Value="{DynamicResource DataHeaderForeground}" />
     <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
     <Setter Property="ScrollViewer.VerticalScrollBarVisibility"   Value="Auto" />
     <Setter Property="VerticalAlignment"                          Value="Stretch" />
     <Setter Property="HorizontalAlignment"                        Value="Stretch" />
     <Setter Property="SnapsToDevicePixels"                        Value="True" />
 </Style>

Here is the custom StyleSelector:

public class AlarmsRowStyleSelector : StyleSelector {
    public Style IsAlarmStyle { get; set; }
    public Style IsAlarmSelectedStyle { get; set; }
    public Style NotAlarmStyle { get; set; }
    public Style NotAlarmSelectedStyle { get; set; }
    public override Style SelectStyle( object item, DependencyObject container ) {
        GridViewRow gridRow = container as GridViewRow;
        ReadViewModel row = item as ReadViewModel;
        if ( row != null && row.IsAlarm ) {
            return gridRow.IsSelected ? IsAlarmSelectedStyle : IsAlarmStyle;
        }
        return gridRow.IsSelected ? NotAlarmSelectedStyle : NotAlarmStyle;
    }
}

And here is the XAML of the form where this is all used:

<UserControl x:Class="CarSystem.CustomControls.Searcher"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:cs="clr-namespace:CarSystem.CustomControls"
             xmlns:vm="clr-namespace:CarSystem.ServiceModel;assembly=ViewModels"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             mc:Ignorable="d"
             Height="620"
             Loaded="Searcher_Loaded"
             Width="990">
  
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="BoolToVisibility" />
        <cs:CoordinateConverter x:Key="CoordConverter" />
        <CollectionViewSource x:Key="ReadsView" />
        <cs:DateConverter x:Key="DateConverter" />
        <cs:LongConverter x:Key="LongConverter" />
  
        <cs:AlarmsRowStyleSelector x:Key="StyleSelector">
            <cs:AlarmsRowStyleSelector.IsAlarmSelectedStyle>
                <Style TargetType="telerik:GridViewRow">
                    <Setter Property="Background" Value="Blue" />
                    <Setter Property="Foreground" Value="Red" />
                    <Setter Property="FontWeight" Value="Bold" />
                </Style>
            </cs:AlarmsRowStyleSelector.IsAlarmSelectedStyle>
            <cs:AlarmsRowStyleSelector.IsAlarmStyle>
                <Style TargetType="telerik:GridViewRow">
                    <Setter Property="Background" Value="{DynamicResource TextBackground}" />
                    <Setter Property="Foreground" Value="Red" />
                    <Setter Property="FontWeight" Value="Bold" />
                </Style>
            </cs:AlarmsRowStyleSelector.IsAlarmStyle>
            <cs:AlarmsRowStyleSelector.NotAlarmSelectedStyle>
                <Style TargetType="telerik:GridViewRow">
                    <Setter Property="Background" Value="Blue" />
                    <Setter Property="Foreground" Value="{DynamicResource TextForeground}" />
                </Style>
            </cs:AlarmsRowStyleSelector.NotAlarmSelectedStyle>
            <cs:AlarmsRowStyleSelector.NotAlarmStyle>
                <Style TargetType="telerik:GridViewRow">
                    <Setter Property="Background" Value="{DynamicResource TextBackground}" />
                    <Setter Property="Foreground" Value="{DynamicResource TextForeground}" />
                </Style>
            </cs:AlarmsRowStyleSelector.NotAlarmStyle>
        </cs:AlarmsRowStyleSelector>
          
        <DataTemplate x:Key="CheckableChoice">
            <CheckBox Content="{Binding Path=Value}"
                      IsChecked="{Binding Path=IsChecked, Mode=TwoWay}" />
        </DataTemplate>
    </UserControl.Resources>
  
    <Grid Background="{DynamicResource ContentBackground}"
          Name="LayoutRoot">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="110" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
  
        <Grid Grid.Column="0"
              Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
  
            <GroupBox BorderBrush="{DynamicResource ControlBorder}"
                      FontSize="16"
                      FontWeight="Bold"
                      Foreground="{DynamicResource TextForeground}"
                      Grid.Column="0"
                      Grid.Row="0"
                      Header="Plate:"
                      Margin="5,0">
                <Border BorderBrush="{DynamicResource ControlBorder}"
                        BorderThickness="1"
                        Height="35"
                        Margin="5"
                        VerticalAlignment="Center">
                    <TextBox FontSize="16"
                             FontWeight="Bold"
                             GotFocus="PlateBox_GotFocus"
                             LostFocus="PlateBox_LostFocus"
                             MaxLength="25"
                             MaxLines="1"
                             Name="PlateBox"
                             TabIndex="0"
                             TextChanged="PlateBox_TextChanged"
                             ToolTip='Wildcards ("%", "_", "[", "]") can be used' />
                </Border>
            </GroupBox>
            <GroupBox BorderBrush="{DynamicResource ControlBorder}"
                      FontSize="16"
                      FontWeight="Bold"
                      Foreground="{DynamicResource TextForeground}"
                      Grid.Column="0"
                      Grid.Row="1"
                      Header="State:"
                      Margin="5,0">
                <cs:TouchComboBox Background="{DynamicResource UnfocusedBackground}"
                                  BorderBrush="{DynamicResource ControlBorder}"
                                  DisplayMemberPath="Value"
                                  FontSize="16"
                                  FontWeight="Bold"
                                  Foreground="{DynamicResource UnfocusedForeground}"
                                  GridBackground="{DynamicResource ContentBackground}"
                                  Height="50"
                                  ItemsSource="{Binding Path=LocaleChoices, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}}"
                                  Margin="5"
                                  x:Name="StatePicker"
                                  SelectedValuePath="Key"
                                  SelectionChanged="StatePicker_SelectionChanged"
                                  TabIndex="1"
                                  TimeOfDayMode="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}}"
                                  VerticalAlignment="Center" />
            </GroupBox>
  
            <GroupBox BorderBrush="{DynamicResource ControlBorder}"
                      FontSize="16"
                      FontWeight="Bold"
                      Foreground="{DynamicResource TextForeground}"
                      Grid.Column="1"
                      Grid.Row="0"
                      Header="Start Date:"
                      Margin="5,0">
                <telerik:RadDateTimePicker FontSize="16"
                                           FontWeight="Bold"
                                           Height="35"
                                           Margin="5"
                                           Name="StartDatePicker"
                                           SelectionChanged="DateTimePicker_SelectionChanged"
                                           TabIndex="2"
                                           VerticalAlignment="Center" />
            </GroupBox>
            <GroupBox BorderBrush="{DynamicResource ControlBorder}"
                      FontSize="16"
                      FontWeight="Bold"
                      Foreground="{DynamicResource TextForeground}"
                      Grid.Column="1"
                      Grid.Row="1"
                      Header="End Date:"
                      Margin="5,0">
                <telerik:RadDateTimePicker FontSize="16"
                                           FontWeight="Bold"
                                           Height="35"
                                           Margin="5"
                                           Name="EndDatePicker"
                                           SelectionChanged="DateTimePicker_SelectionChanged"
                                           TabIndex="3"
                                           VerticalAlignment="Center" />
            </GroupBox>
  
            <GroupBox BorderBrush="{DynamicResource ControlBorder}"
                      FontSize="16"
                      FontWeight="Bold"
                      Foreground="{DynamicResource TextForeground}"
                      Grid.Column="2"
                      Grid.Row="0"
                      Header="Alarm Class:"
                      Margin="5,0">
                <Grid VerticalAlignment="Center">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="35" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <CheckBox Click="AllAlarmClasses_Click"
                              Content="ALL"
                              FontSize="16"
                              FontWeight="Bold"
                              Grid.Column="0"
                              Grid.Row="0"
                              HorizontalAlignment="Left"
                              Margin="5"
                              Name="AllAlarmClassesButton"
                              TabIndex="4"
                              VerticalAlignment="Center" />
                    <Button Background="{DynamicResource ButtonBackground}"
                            Click="ExpandPicker_Click"
                            Content="Expand"
                            FontSize="16"
                            FontWeight="Bold"
                            Foreground="{DynamicResource ButtonForeground}"
                            Grid.Column="1"
                            Grid.Row="0"
                            Height="30"
                            Name="ExpandAlarmClass"
                            TabIndex="5" />
                    <ListBox BorderBrush="Black"
                             BorderThickness="1"
                             CheckBox.Click="AlarmClassPicker_Click"
                             ItemTemplate="{StaticResource CheckableChoice}"
                             FontSize="16"
                             FontWeight="Bold"
                             Grid.Column="0"
                             Grid.ColumnSpan="2"
                             Grid.Row="1"
                             Height="100"
                             ItemsSource="{Binding Path=AlarmClassChoices, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}, Mode=TwoWay}"
                             Margin="5,0"
                             Name="AlarmClassPicker"
                             SelectionMode="Multiple"
                             TabIndex="6"
                             Visibility="Collapsed" />
                </Grid>
            </GroupBox>
  
            <GroupBox BorderBrush="{DynamicResource ControlBorder}"
                      FontSize="16"
                      FontWeight="Bold"
                      Foreground="{DynamicResource TextForeground}"
                      Grid.Column="2"
                      Grid.Row="1"
                      Header="Hot List:"
                      Margin="5,0">
                <cs:TouchComboBox Background="{DynamicResource UnfocusedBackground}"
                                  BorderBrush="{DynamicResource ControlBorder}"
                                  FontSize="16"
                                  FontWeight="Bold"
                                  Foreground="{DynamicResource UnfocusedForeground}"
                                  GridBackground="{DynamicResource ContentBackground}"
                                  Height="50"
                                  IsTabStop="True"
                                  ItemsSource="{Binding Path=HotListChoices, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}, Mode=TwoWay}"
                                  KeyboardNavigation.TabIndex="4"
                                  Margin="5,0"
                                  x:Name="HotListPicker"
                                  SelectedIndex="0"
                                  SelectionChanged="SourcePicker_SelectionChanged"
                                  TabIndex="7"
                                  TimeOfDayMode="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}}"
                                  VerticalAlignment="Top" />
            </GroupBox>            
        </Grid>
  
        <TabControl Background="{DynamicResource TabBackground}"
                    Grid.Row="1"
                    Margin="0,20,0,5"
                    Name="ResultTabs">
  
            <TabItem Background="{DynamicResource TabHeaderBackground}"
                     FontSize="16"
                     FontWeight="Bold"
                     Foreground="{DynamicResource TabHeaderForeground}"
                     Header="Hot List Entries:"
                     Name="HotListEntryTab">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
  
                    <telerik:RadGridView AutoExpandGroups="True"
                                         AutoGenerateColumns="False"
                                         CanUserDeleteRows="False"
                                         CanUserFreezeColumns="False"
                                         CanUserInsertRows="False"
                                         CanUserResizeColumns="True"
                                         CanUserSortColumns="True"
                                         EnableColumnVirtualization="True"
                                         EnableRowVirtualization="True"
                                         FontSize="16"
                                         FontWeight="Bold"
                                         IsReadOnly="True"
                                         Name="HotListEntriesGrid"
                                         SelectionChanged="HotListEntriesGrid_SelectionChanged"
                                         SelectionUnit="FullRow"
                                         ScrollViewer.CanContentScroll="True"
                                         ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                         ScrollViewer.VerticalScrollBarVisibility="Auto"
                                         ToolTip="Matching Hot List Entries">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Plate,        Mode=OneWay}"
                                                        Header="Plate"
                                                        Width="1.5*" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding LocaleCode, Mode=OneWay}"
                                                        Header="State"
                                                        Width="75" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding ListName,   Mode=OneWay}"
                                                        Header="Hot List"
                                                        Width="150" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding AlarmClass, Mode=OneWay}"
                                                        Header="Alarm Class"
                                                        Width="175" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Notes,     Mode=OneWay}"
                                                        Header="Notes"
                                                        Width="1*" />
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                    <cs:ProgressControl FontSize="16"
                                        FontWeight="Bold"
                                        Grid.Column="0"
                                        Grid.Row="1"
                                        Height="55"
                                        Margin="0,5"
                                        x:Name="HotListProgressCtrl"
                                        TimeOfDayMode="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}}"
                                        Visibility="Collapsed" />
                </Grid>
            </TabItem>
  
            <TabItem Background="{DynamicResource TabHeaderBackground}"
                     FontSize="16"
                     FontWeight="Bold"
                     Foreground="{DynamicResource TabHeaderForeground}"
                     Header="Reads & Alarms:"
                     IsSelected="True"
                     Name="ReadsTabItem">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
  
                    <telerik:RadGridView AutoExpandGroups="True"
                                         AutoGenerateColumns="False"
                                         CanUserDeleteRows="False"
                                         CanUserFreezeColumns="False"
                                         CanUserInsertRows="False"
                                         CanUserResizeColumns="True"
                                         CanUserSortColumns="True"
                                         EnableColumnVirtualization="True"
                                         EnableRowVirtualization="True"
                                         FontSize="16"
                                         FontWeight="Bold"
                                         IsReadOnly="True"
                                         Name="ReadsGrid"
                                         RowStyleSelector="{StaticResource StyleSelector}"
                                         SelectionChanged="ReadsGrid_SelectionChanged"
                                         SelectionUnit="FullRow"
                                         ScrollViewer.CanContentScroll="True"
                                         ScrollViewer.HorizontalScrollBarVisibility="Auto"
                                         ScrollViewer.VerticalScrollBarVisibility="Auto"
                                         ShowGroupFooters="True"
                                         ToolTip="Matching Reads">
                        <telerik:RadGridView.Columns>
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding Plate,       Mode=OneWay}"
                                                        Header="Plate"
                                                        Width="*" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding State,       Mode=OneWay}"
                                                        Header="State"
                                                        Width="75" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding TimeStamp,  Mode=OneWay, Converter={StaticResource DateConverter}}"
                                                        Header="Date & Time"
                                                        Width="175" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding GPSInformation.Position.Latitude, Converter={StaticResource CoordConverter}, ConverterParameter=NS}"
                                                        Header="Latitude"
                                                        Width="142" />
                            <telerik:GridViewDataColumn DataMemberBinding="{Binding GPSInformation.Position.Longitude, Converter={StaticResource CoordConverter}, ConverterParameter=EW}"
                                                        Header="Longitude"
                                                        Width="142" />
                        </telerik:RadGridView.Columns>
                    </telerik:RadGridView>
                    <cs:ProgressControl FontSize="16"
                                        FontWeight="Bold"
                                        Grid.Row="1"
                                        Height="55"
                                        Margin="0,5"
                                        x:Name="ProgressCtrl"
                                        TimeOfDayMode="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}}"
                                        Visibility="Collapsed" />
                </Grid>
            </TabItem>
        </TabControl>
  
        <GridSplitter Background="{DynamicResource SeparatorColor}"
                      Grid.Row="1"
                      Height="10"
                      HorizontalAlignment="Stretch"
                      Margin="0,5"
                      VerticalAlignment="Top" />
  
        <Grid Grid.Column="1"
              Grid.Row="0"
              Grid.RowSpan="3">
            <Grid.RowDefinitions>
                <RowDefinition Height="65" />
                <RowDefinition Height="65" />
                <RowDefinition Height="65" />
                <RowDefinition Height="65" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="65" />
                <RowDefinition Height="65" />
            </Grid.RowDefinitions>
            <Button Background="{DynamicResource ButtonBackground}"
                    Click="SearchButton_Click"
                    Content="Search"
                    FontSize="16"
                    FontWeight="Bold"
                    Foreground="{DynamicResource ButtonForeground}"
                    Grid.Row="0"
                    IsDefault="True"
                    Margin="5"
                    Name="SearchButton"
                    TabIndex="8" />
            <Button Background="{DynamicResource ButtonBackground}"
                    Click="ClearButton_Click"
                    Content="Clear"
                    FontSize="16"
                    FontWeight="Bold"
                    Foreground="{DynamicResource ButtonForeground}"
                    Grid.Row="1"
                    Margin="5"
                    Name="ClearButton"
                    TabIndex="9" />
            <Button Background="{DynamicResource ButtonBackground}"
                    Click="InsertButton_Click"
                    Content="Insert"
                    FontSize="16"
                    FontWeight="Bold"
                    Foreground="{DynamicResource ButtonForeground}"
                    IsEnabled="{Binding Path=OkToInsertHotListEntry, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}}"
                    Grid.Row="2"
                    Margin="5"
                    Name="InsertButton"
                    TabIndex="10" />
            <Button Background="{DynamicResource ButtonBackground}"
                    Click="SaveCriteriaButton_Click"
                    FontSize="16"
                    FontWeight="Bold"
                    Grid.Row="3"
                    Foreground="{DynamicResource ButtonForeground}"
                    IsEnabled="{Binding Path=OkToSaveCriteria, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}}"
                    Margin="5"
                    Name="SaveCriteriaButton"
                    TabIndex="11">
                <Button.Content>
                    <TextBlock Text="Save Search"
                               TextAlignment="Center"
                               TextWrapping="Wrap" />
                </Button.Content>
            </Button>
            <TextBlock FontSize="16"
                       FontWeight="Bold"
                       Foreground="{DynamicResource TextForeground}"
                       Grid.Row="5"
                       Margin="5"
                       Text="Number of Matches:"
                       TextAlignment="Center"
                       TextWrapping="Wrap" />
            <TextBlock FontSize="16"
                       FontWeight="Bold"
                       Foreground="{DynamicResource TextForeground}"
                       Grid.Row="6"
                       Margin="6"
                       Text="Hot List Entries:"
                       TextAlignment="Center"
                       TextWrapping="Wrap" />
            <TextBlock FontSize="16"
                       FontWeight="Bold"
                       Foreground="{DynamicResource TextForeground}"
                       Grid.Row="7"
                       Margin="5,0,5,10"
                       Text="{Binding Converter={StaticResource LongConverter}, ConverterParameter='#,##0', Path=NoHotListEntries, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}}"
                       TextAlignment="Center"
                       TextWrapping="Wrap" />
            <TextBlock FontSize="16"
                       FontWeight="Bold"
                       Foreground="{DynamicResource TextForeground}"
                       Grid.Row="8"
                       Margin="5"
                       Text="Reads:"
                       TextAlignment="Center"
                       TextWrapping="Wrap" />
            <TextBlock FontSize="16"
                       FontWeight="Bold"
                       Foreground="{DynamicResource TextForeground}"
                       Grid.Row="9"
                       Margin="5,0,5,10"
                       Text="{Binding Converter={StaticResource LongConverter}, ConverterParameter='#,##0', Path=NoReads, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}}"
                       TextAlignment="Center"
                       TextWrapping="Wrap" />
            <Button Background="{DynamicResource ButtonBackground}"
                    Click="ExportButton_Click"
                    Content="Export"
                    FontSize="16"
                    FontWeight="Bold"
                    Foreground="{DynamicResource ButtonForeground}"
                    Grid.Row="11"
                    Margin="5"
                    Name="ExportButton"
                    TabIndex="12" />
            <Button Background="{DynamicResource ButtonBackground}"
                    Click="CloseButtonClicked"
                    Content="Close"
                    FontSize="16"
                    FontWeight="Bold"
                    Foreground="{DynamicResource ButtonForeground}"
                    Grid.Row="12"
                    HorizontalAlignment="Right"
                    Margin="5"
                    Name="CloseButton"
                    TabIndex="13"
                    Width="100" />
        </Grid>
  
        <Canvas Grid.Column="0"
                Grid.ColumnSpan="2"
                Grid.Row="0"
                Grid.RowSpan="4"
                Name="KeyboardPopupCanvas">
            <cs:KeyboardPopup Left="-16.5"
                              x:Name="KeyboardPopup"
                              TimeOfDayMode="{Binding Path=TimeOfDayMode, RelativeSource={RelativeSource AncestorType={x:Type cs:Searcher}}}"
                              Title="Keyboard"
                              Top="160"
                              Visibility="Collapsed" />
        </Canvas>
  
    </Grid>
</UserControl>

I really need the color changes to work.  I'm pretty sure I screwed something up in the templates, but I have no idea what.  Can someone look at this and see if they can figure it out?

Thanks

Tony

12 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 06 Jun 2012, 07:15 AM
Hi Tony,

 

If you want to change the Foreground property of the row why not directly use its Foreground property of the row?. As described in our documentation if you want to change Background of the selected row you should modify the Border element named Background_Selected. If you want to change the Foreground of the selected row you may animate the DataCellsPresenter which is responsible for displaying GridViewCell. On a row basis you do not need to deal with the Foreground property of the cell. I am attaching you small sample project which demonstrates how to achieve this. Please have a look at it and if you have any additional questions let us know. Furthermore you may also submit a support ticket where you may attach your demo where we can see what is wrong. 





All the best,
Vanya Pavlova
the Telerik team

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

0
Tony
Top achievements
Rank 1
answered on 17 Jul 2012, 05:54 PM
Vanya:

I just found this response.  I would take a look at your code, but the link doesn't work!

Also, I am modifying the Foreground property, and it's not changing the color of the text in the cells.  I think I have something conflicting with something else in my templates, but I don't know what.  I have to find it.

It's important that the foreground color of the rows which match a specific condition be changed.  The condition is a bool property of the data in the column.  I had created a custom RowStyleSelector class which used to work, but it got broken somewhere.  I'm about to go into my code and try by trial and error to find the style that broke the display.  This ought to be fun.

Tony
0
Tony
Top achievements
Rank 1
answered on 17 Jul 2012, 06:21 PM
I've found the issue:  The definition of my telerik:DataCellsPresenter was conflicting with the changes I was trying to make to the Foreground property of the GridViewRow in the styles I was using with the custom RowStyleSelector class.  When I removed the definition and put the changes I was trying to make into the GridViewRow template, then everything worked.

Tony

PS:  Actually, it wasn't quite that simple.  The foreground colors worked, but the change to Night Mode didn't.  I had to restore the DataCellsPresenter template and delete the setters for the Foreground property from that template and from my template for the GridViewCell class.  Once I did that, the Night Mode and Foreground changes took effect.

I've got the SelectionUnit property on my RadGridView controls set to FullRow, but only the first column is selected.  I suspect this is another problem in my GridViewRow or GridViewCell or DataCellsPresenter templates, or some combination there-of.  Also, I changed the Background property of the Background_Selected element in the GridViewRow template and that didn't have any effect.  Back to the trial and error stuff.

PPS:  OK, I deleted the GridViewCell template and the entire row gets selected.  The color isn't the one I want, and Night Mode is broken.  I'm setting the Background property of the GridViewRow to my DynamicResource but it's not changing when I go to night mode.  What am I doing wrong now?

PPPS:  I've got everything working.  I totally deleted the tempate for the GridViewCell type.  In order to get the entire row to show selected and get Night Mode working right, I had to do 2 things:

1. In 2 of the RadGridView controls in my program, I'm using a custom RowStyleSelector class.  I set the Background property to my DynamicResource in the styles associated with these controls and that worked.

2. In the other 2 RadGridView controls in my program, I set the RowStyle property of the RadGridView, as shown in this posting.

The only problem I have now is the colors I've chosen for the selected row in the RadGridView aren't showing.  Instead, they are showing up as a shade of yellow.  Time to figure out what's going on there.
0
Vanya Pavlova
Telerik team
answered on 18 Jul 2012, 11:08 AM
Hi Tony,

 


I believe that the best option here is to submit a support ticket with sample application, where the problem can be observed. If you can isolate it in a small runnable project we would be able to test the behavior by our side and to provide you with an appropriate solution.  



Regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Miguel Angel Chico
Top achievements
Rank 1
answered on 02 Aug 2012, 11:26 AM
Hi!

I'm trying to download the ZIP file but it's not available now. How can I get it?

Thanks!
0
Vanya Pavlova
Telerik team
answered on 03 Aug 2012, 11:01 AM
Hi Miguel,

 


Indeed the file is not available now, sorry for this! Will you please share with us what exactly are you trying to accomplish? Based on your scenario I will be glad to help prepare small sample demo which illustrates how this can be achieved.  




Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Miguel Angel Chico
Top achievements
Rank 1
answered on 03 Aug 2012, 11:15 AM
Hi Vanya,

I'm just creating a control with a RadGridView inside that allow users edit the cells values. I expect that, when user inserts a value, the application checks all row values and change cell's background where the cell's value isn't value. By example, imagine the row:

Name | Age | AllowDrive | Children (nº)

And a user named "John", 25, Yes, 1

If I change John's age to 17, Allow Drive's value (Yes) isn't correct and background color must be red.

If I change John's age to 5, Allow Drive's value (Yes) isn't correct and background color must be red, and John cannot have a children: the cell must be red. If user changes now values (children = 0 or Allow Drive = false), the grid must call to validator and now the background must be white (or the default value).

How can I implemente something like this?




Like a first approach (that only changes the changed cell's color) I'm trying using a StyleSelector and giving it programatically (the datasource is dynamic, a dataset with values), with something like this:

	    // Load Cell Styles after set binding
            SampleStyleSelector cellStyle = new SampleStyleSelector();
        
            foreach(GridViewDataColumn column in radGridView1.Columns)
            {
                column.CellStyleSelector = cellStyle;
            }


And my SampleStyleSelector is:

 public class SampleStyleSelector : StyleSelector
        {
           public override Style SelectStyle( object item, DependencyObject container )
           {
               string value = string.Empty;
 
               if (null != ((Telerik.Windows.Controls.GridView.GridViewCell)container).Value)
               {
                   value = ((Telerik.Windows.Controls.GridView.GridViewCell)container).Value.ToString();
               }              
 
               if (value.Length > 3)
               {
                   return this.RedStyle;                   
               }
               else
               {
                   return this.GreenStyle;
               }
            }
 
       public SampleStyleSelector()       
       {
           Style s = new Style(typeof(Telerik.Windows.Controls.GridView.GridViewCell));
           s.RegisterName("Background"Brushes.Green);
 
           GreenStyle = s;
 
           Style s2 = new Style(typeof(Telerik.Windows.Controls.GridView.GridViewCell));
           s2.RegisterName("Background"Brushes.Red);
 
           RedStyle = s2;
 
       }
 
       public Style RedStyle
       {
           get;
           set;
       }
 
           public Style GreenStyle
           {
               get;
               set;
           }       
        }

but when user changes the value, grid doesn't show changes.

Thanks a lot!

Miguel.


0
Vanya Pavlova
Telerik team
answered on 06 Aug 2012, 12:34 PM
Hi Miguel,

 


Thank you for providing this information! Generally it is not recommended to directly work with the visual elements (in this case GridViewCell) and their content. Such an attempt may lead to unexpected behavior.
It would be much more appropriate to work with the underlying property values instead - then everything should work correctly. 



Kind regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Miguel Angel Chico
Top achievements
Rank 1
answered on 07 Aug 2012, 06:35 AM
Hi Vanya,

Thank you for your response. :) Could you send me a basic sample with these functionallity working as you told me? 

I would be very useful and a help and I would be very grateful.

Thanks for everything.

Miguel.

0
Vanya Pavlova
Telerik team
answered on 07 Aug 2012, 08:10 AM
Hello Miguel,

 


Thank you for getting back to us! You may refer to our documentation and online demos for further reference, please follow these links:
                                                               "What is a Style Selector?"
                        "Conditional styles and templates with RadGridView for Silverlight and WPF"
                                                                     "CellStyleSelector"


If you encounter any other problems do not hesitate to contact us! 


Regards,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Sasireka
Top achievements
Rank 1
answered on 21 Jun 2013, 07:05 AM
Hi,

I need to change the fore color of one column in rad gridview (By default the column values should be in oranage color text).

Please share any samples.

Regards,
Sasireka
0
Nick
Telerik team
answered on 25 Jun 2013, 09:57 AM
Hi Sasireka,

Here is an example of CellStyleSelector. You can use it with very little modifications to achieve your requirement.

Hope it helps!  

Regards,
Nik
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Tony
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Tony
Top achievements
Rank 1
Miguel Angel Chico
Top achievements
Rank 1
Sasireka
Top achievements
Rank 1
Nick
Telerik team
Share this question
or