This question is locked. New answers and comments are not allowed.
I have styled the Grid to match the style of our application. I had to change the selected cell style as well. The selection of the cell works as expected, however after a cell is deselected, it returns back to the default Telerik style. I am having a hard time trying to figure out why it isn't returning to the custom style that I have applied. I have attached an image that shows what is happening.
Here is the Grid Code:
<telerikGrid:RadDataGrid Grid.Row="1"
Style="{StaticResource BidsGridStyle}"
ItemsSource="{Binding Details}"
AutoGenerateColumns="False"
SelectionMode="Multiple"
SelectionChanged="RadDataGrid_SelectionChanged"
SelectionUnit="Row"
UserGroupMode="Disabled"
UserColumnReorderMode="None"
UserFilterMode="Disabled"
UserEditMode="Inline"
Width="1000">
<telerikGrid:RadDataGrid.Columns>
<telerikGrid:DataGridTextColumn PropertyName="Code"
CellContentStyleSelector="{StaticResource ForegroundSelector}"
Header="Code"
HeaderStyle="{ThemeResource BidsGridHeaderStyle}"
SizeMode="Fixed"
Width="120" />
<telerikGrid:DataGridTextColumn PropertyName="Description"
CellContentStyleSelector="{StaticResource ForegroundSelector}"
Header="Description"
HeaderStyle="{ThemeResource BidsGridHeaderStyle}"/>
<telerikGrid:DataGridTextColumn PropertyName="Plan"
CellContentStyleSelector="{StaticResource ForegroundSelector}"
Header="Plan"
HeaderStyle="{ThemeResource BidsGridHeaderStyle}"
SizeMode="Fixed"
Width="75" />
<telerikGrid:DataGridTextColumn PropertyName="Elevation"
CellContentStyleSelector="{StaticResource ForegroundSelector}"
Header="Elev"
HeaderStyle="{ThemeResource BidsGridHeaderStyle}"
SizeMode="Fixed"
Width="50"/>
<telerikGrid:DataGridTextColumn PropertyName="OptionWithDescription"
CellContentStyleSelector="{StaticResource ForegroundSelector}"
Header="Option: Description"
HeaderStyle="{ThemeResource BidsGridHeaderStyle}"/>
</telerikGrid:RadDataGrid.Columns>
</telerikGrid:RadDataGrid>
Here is the Grid Style Code:
<Style x:Key="BidsGridStyle" TargetType="telerikGrid:RadDataGrid">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{ThemeResource ApplicationForegroundThemeBrush}" />
<Setter Property="GridLinesVisibility" Value="Horizontal" />
<Setter Property="GridLinesThickness" Value="1" />
<Setter Property="GridLinesBrush" Value="{ThemeResource LineDividerThemeBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style x:Key="BidsGridHeaderStyle" TargetType="gridPrimitives:DataGridColumnHeader">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{ThemeResource AlternativeForegroundBrush}" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style TargetType="gridPrimitives:SelectionRegionBackgroundControl">
<Setter Property="Background" Value="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}"/>
<Setter Property="BorderBrush" Value="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}"/>
<Setter Property="BorderThickness" Value="2"/>
</Style>
<Style TargetType="gridPrimitives:SelectionRegionBorderControl">
<Setter Property="BorderBrush" Value="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}"/>
<Setter Property="Background" Value="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}" />
</Style>
<Style TargetType="gridPrimitives:DataGridCellsPanel">
<Setter Property="Background" Value="Red" />
</Style>
<resources:CellStyleSelector x:Key="ForegroundSelector">
<resources:CellStyleSelector.SelectedStyle>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Margin" Value="10"/>
</Style>
</resources:CellStyleSelector.SelectedStyle>
<resources:CellStyleSelector.NormalStyle>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource ApplicationForegroundThemeBrush}" />
<Setter Property="Margin" Value="10"/>
</Style>
</resources:CellStyleSelector.NormalStyle>
</resources:CellStyleSelector>
Thank you in advance.
Here is the Grid Code:
<telerikGrid:RadDataGrid Grid.Row="1"
Style="{StaticResource BidsGridStyle}"
ItemsSource="{Binding Details}"
AutoGenerateColumns="False"
SelectionMode="Multiple"
SelectionChanged="RadDataGrid_SelectionChanged"
SelectionUnit="Row"
UserGroupMode="Disabled"
UserColumnReorderMode="None"
UserFilterMode="Disabled"
UserEditMode="Inline"
Width="1000">
<telerikGrid:RadDataGrid.Columns>
<telerikGrid:DataGridTextColumn PropertyName="Code"
CellContentStyleSelector="{StaticResource ForegroundSelector}"
Header="Code"
HeaderStyle="{ThemeResource BidsGridHeaderStyle}"
SizeMode="Fixed"
Width="120" />
<telerikGrid:DataGridTextColumn PropertyName="Description"
CellContentStyleSelector="{StaticResource ForegroundSelector}"
Header="Description"
HeaderStyle="{ThemeResource BidsGridHeaderStyle}"/>
<telerikGrid:DataGridTextColumn PropertyName="Plan"
CellContentStyleSelector="{StaticResource ForegroundSelector}"
Header="Plan"
HeaderStyle="{ThemeResource BidsGridHeaderStyle}"
SizeMode="Fixed"
Width="75" />
<telerikGrid:DataGridTextColumn PropertyName="Elevation"
CellContentStyleSelector="{StaticResource ForegroundSelector}"
Header="Elev"
HeaderStyle="{ThemeResource BidsGridHeaderStyle}"
SizeMode="Fixed"
Width="50"/>
<telerikGrid:DataGridTextColumn PropertyName="OptionWithDescription"
CellContentStyleSelector="{StaticResource ForegroundSelector}"
Header="Option: Description"
HeaderStyle="{ThemeResource BidsGridHeaderStyle}"/>
</telerikGrid:RadDataGrid.Columns>
</telerikGrid:RadDataGrid>
Here is the Grid Style Code:
<Style x:Key="BidsGridStyle" TargetType="telerikGrid:RadDataGrid">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{ThemeResource ApplicationForegroundThemeBrush}" />
<Setter Property="GridLinesVisibility" Value="Horizontal" />
<Setter Property="GridLinesThickness" Value="1" />
<Setter Property="GridLinesBrush" Value="{ThemeResource LineDividerThemeBrush}" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<Style x:Key="BidsGridHeaderStyle" TargetType="gridPrimitives:DataGridColumnHeader">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{ThemeResource AlternativeForegroundBrush}" />
<Setter Property="FontWeight" Value="Bold" />
</Style>
<Style TargetType="gridPrimitives:SelectionRegionBackgroundControl">
<Setter Property="Background" Value="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}"/>
<Setter Property="BorderBrush" Value="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}"/>
<Setter Property="BorderThickness" Value="2"/>
</Style>
<Style TargetType="gridPrimitives:SelectionRegionBorderControl">
<Setter Property="BorderBrush" Value="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}"/>
<Setter Property="Background" Value="{ThemeResource ListViewItemSelectedBackgroundThemeBrush}" />
</Style>
<Style TargetType="gridPrimitives:DataGridCellsPanel">
<Setter Property="Background" Value="Red" />
</Style>
<resources:CellStyleSelector x:Key="ForegroundSelector">
<resources:CellStyleSelector.SelectedStyle>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="White"/>
<Setter Property="Margin" Value="10"/>
</Style>
</resources:CellStyleSelector.SelectedStyle>
<resources:CellStyleSelector.NormalStyle>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource ApplicationForegroundThemeBrush}" />
<Setter Property="Margin" Value="10"/>
</Style>
</resources:CellStyleSelector.NormalStyle>
</resources:CellStyleSelector>
Thank you in advance.