In our application the ribbon buttons are created dynamically in code, the images for the button (property ImageSourceSmall) are converted from Paths (defined in similar Resources as below) to Imagesource.
<Style x:Key="CrossIcon" TargetType="{x:Type ContentControl}">
<Setter Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<Viewbox xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<Grid>
<Grid Name="backgroundGrid" Width="48" Height="48" Visibility="Collapsed" />
<Path Data="M7.1999998,0L16,8.7999997 24.799999,0 32,7.1999998 23.2,16 32,24.799999 24.799999,32 16,23.2 7.1999998,32 0,24.799999 8.7999997,16 0,7.1999998z" Stretch="Uniform"
Fill="{DynamicResource {x:Static themes:AssetResourceKeys.ControlForegroundNormalBrushKey}}" Width="26" Height="26" Margin="0,0,0,0" RenderTransformOrigin="0.5,0.5">
<Path.RenderTransform>
<TransformGroup>
<TransformGroup.Children>
<RotateTransform Angle="0" />
<ScaleTransform ScaleX="1" ScaleY="1" />
</TransformGroup.Children>
</TransformGroup>
</Path.RenderTransform>
</Path>
</Grid>
</Viewbox>
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
We do not use png images for the button images.
Everything work ok but when I change the theme to another e.g.:
ThemeManager.CurrentTheme = ThemeName.MetroDark.ToString();
so the color of image for the button is not changed, it stays according to the initial defined theme. I suspect it is for the way I create the images in converter. How to achive the color of these images to be changed properly? Where I can send a sample app?
Thanks!
[Modified 6 years ago]