Jonathan Miller
Top achievements
Rank 1
Jonathan Miller
asked on 20 Nov 2008, 09:00 PM
Is there a way I can modify the colors on the simple theme?
(using the grid) When an item is highlighted, I want the text color to be white instead of black. Thanks
(using the grid) When an item is highlighted, I want the text color to be white instead of black. Thanks
3 Answers, 1 is accepted
0
Accepted
Hello Jonathan,
If you want the Style of a GridViewRow to change in response to property changes I suggest you define Triggers for the Style change.
The following code illustrates how you can change the TextBlock.ForeGround property of the GridViewRow when it is selected or hovered:
Regards,
Rosi
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
If you want the Style of a GridViewRow to change in response to property changes I suggest you define Triggers for the Style change.
The following code illustrates how you can change the TextBlock.ForeGround property of the GridViewRow when it is selected or hovered:
<Window.Resources> |
<Style TargetType="{x:Type telerik:GridViewRow}"> |
<Setter Property="TextBlock.Foreground" Value="Red" /> |
<Style.Triggers> |
<Trigger Property="IsMouseOver" Value="True"><!--this will change the style when the row is hovered--> |
<Setter Property="TextBlock.Foreground" Value="Blue" /> |
</Trigger> |
<Trigger Property="IsSelected" Value="True"><!--this will change the style when the row is selected--> |
<Setter Property="TextBlock.Foreground" Value="Green" /> |
</Trigger> |
</Style.Triggers> |
</Style> |
</Window.Resources> |
Regards,
Rosi
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jonathan Miller
Top achievements
Rank 1
answered on 24 Nov 2008, 04:12 PM
Thank you for the assist. The triggers work great with a small exception - my data is in a hierarchy. The parent rows aren't changing colors, only the children. Any ideas?
0
Hello Jonathan Miller,
Thanks for the feedback. The issue you reported is actually a bug in our theme, so I updated your Telerik points.
I've fix templates for the GridViewExpandableRow and HierarchyChildPresenter controls in order to take care about the foreground of the parent object.
You can use this modified templates to achieve your goals. Or you can use modified version of the Telerik.Windows.Controls.Simple.dll which I'm attaching as part of a sample project.
If you have any further questions, please let me know.
Sincerely yours,
Nedyalko Nikolov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Thanks for the feedback. The issue you reported is actually a bug in our theme, so I updated your Telerik points.
I've fix templates for the GridViewExpandableRow and HierarchyChildPresenter controls in order to take care about the foreground of the parent object.
<ControlTemplate x:Key="GridViewExpandableRowTableTemplate" TargetType="{x:Type telerik:GridViewExpandableRow}"> |
<Border Margin="0" Background="{TemplateBinding Background}" HorizontalAlignment="Left" Width="{Binding Path=VisibleColumnsWidth, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type grid:GridViewItemsControl}}}"> |
<Border Name="SelectionBackground" Margin="0" Opacity="1" BorderThickness="0,1,0,1" VerticalAlignment="Top" BorderBrush="#0000BBFF"> |
<Border.Background> |
<LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1"> |
<GradientStop Color="#0000308F" Offset="0"/> |
<GradientStop Color="#00000000" Offset="1"/> |
<GradientStop Color="#00000510" Offset="0.501"/> |
<GradientStop Color="#00006290" Offset="0.504"/> |
</LinearGradientBrush> |
</Border.Background> |
<Grid> |
<Grid.ColumnDefinitions> |
<ColumnDefinition Width="Auto"/> |
<ColumnDefinition/> |
</Grid.ColumnDefinitions> |
<telerik:NavigationPresenter x:Name="PART_NavigationPresenter" Grid.Column="0" /> |
<telerik:HierarchyChildPresenter x:Name="PART_HierarchyChildPresenter" Grid.Column="1" Foreground="{TemplateBinding Foreground}" /> |
</Grid> |
</Border> |
</Border> |
<ControlTemplate.Triggers> |
<Trigger Property="IsSelected" Value="True"> |
<Setter Property="Background" TargetName="SelectionBackground" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/> |
</Trigger> |
</ControlTemplate.Triggers> |
</ControlTemplate> |
<ControlTemplate x:Key="HierarchyChildPresenterTableTemplate" TargetType="{x:Type telerik:HierarchyChildPresenter}"> |
<grid:HorizontalScrollPanel Grid.Row="1" x:Name="PART_PartialScrollContainer" > |
<Expander x:Name="PART_Expander" IsExpanded="{Binding Path=IsExpanded, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type telerik:GridViewExpandableRow}}}" Background="Transparent" Style="{StaticResource GridViewExpandableRowExpanderStyle}" > |
<Expander.Header> |
<Grid Name="PART_RowGrid" TextBlock.Foreground="{TemplateBinding Foreground}"> |
<Grid.RowDefinitions> |
<RowDefinition Height="Auto" MinHeight="22" /> |
</Grid.RowDefinitions> |
</Grid> |
</Expander.Header> |
</Expander> |
</grid:HorizontalScrollPanel> |
</ControlTemplate> |
You can use this modified templates to achieve your goals. Or you can use modified version of the Telerik.Windows.Controls.Simple.dll which I'm attaching as part of a sample project.
If you have any further questions, please let me know.
Sincerely yours,
Nedyalko Nikolov
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.