New to Telerik UI for WPF? Download free 30-day trial

How to Change the RadGlyph Icons' Color when Changing the Theme Variation During Runtime

Environment

Product Version 2021.2.615
Product Progress® Telerik® UI for WPF

Description

How to change the RadGlyph icons' color when changing the theme variation during runtime.

Solution

To have the RadGlyph icon reflect the change of the theme variation, you can use a GeometryDrawing object and bind it's brush's Color property to a specified color from the respective theme palette.

<telerik:RadMenuItem.Icon> 
    <Image Stretch="UniformToFill" Width="35" Height="20" Margin="2"> 
        <Image.Source> 
            <DrawingImage> 
                <DrawingImage.Drawing> 
                    <GeometryDrawing Geometry="{telerik:RadGlyph Type=Path, Glyph={StaticResource GlyphCs}}"> 
                        <GeometryDrawing.Brush> 
                            <SolidColorBrush Color="{Binding Source={x:Static telerik:Office2019Palette.Palette}, Path=MainForegroundColor}" /> 
                        </GeometryDrawing.Brush> 
                    </GeometryDrawing> 
                </DrawingImage.Drawing> 
            </DrawingImage> 
        </Image.Source> 
    </Image> 
</telerik:RadMenuItem.Icon> 

The above example uses the Office2019Palette, but you can replace this with the palette for the theme(s) you're using.

See Also

In this article