I am trying to change the color of my label based off an enum set in xaml. I can not get the colors to update. Any help would be great.
Thanks!
<UserControl.Resources>
<!-- Normal -->
<SolidColorBrush x:Key="Normal_bg_Unselect" Color="#FF1A73CC" />
<SolidColorBrush x:Key="Normal_fg_Unselect" Color="#FF72BAFF" />
<SolidColorBrush x:Key="Normal_bg_Select" Color="#FF1ACCBF" />
<SolidColorBrush x:Key="Normal_fg_Select" Color="#FF91FFFF" />
</UserControl.Resources>
<Grid>
<Label Name="BackgroundLabel" Width="Auto" Height="Auto" BorderThickness="0" Panel.ZIndex="1" Cursor="Hand">
<Label.Foreground>
<SolidColorBrush Color="{DynamicResource Color_LightBlue}"/>
</Label.Foreground>
<Label.Style>
<Style TargetType="{x:Type Label}">
<Setter Property="Background" Value="{Binding BgUnselect}" />
<Setter Property="Foreground" Value="{Binding FgUnselect}" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{Binding BgSelect}" />
<Setter Property="Foreground" Value="{Binding FgSelect}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="False">
<Setter Property="Background" Value="{Binding BgUnselect}" />
<Setter Property="Foreground" Value="{Binding FgUnselect}" />
</Trigger>
</Style.Triggers>
</Style>
</Label.Style>
<Label.OpacityMask>
<LinearGradientBrush>
<GradientStop Color="#00FFFFFF" Offset="-.35"/>
<GradientStop Color="#FFFFFFFF" Offset="1"/>
</LinearGradientBrush>
</Label.OpacityMask>
</Label>
<TextBlock Name="ContentLabel" Text="{Binding Text, RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, FallbackValue='Styled Button'}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="20,0,0,0" FontFamily="/HarringtonGroup.TrainingBuilder;component/Fonts/#HelveticaNeue" FontSize="30" Foreground="{Binding ElementName=BackgroundLabel, Path=Foreground}" />
</Grid>
Code Behind
public SolidColorBrush BgUnselect { get; set; }
public SolidColorBrush FgUnselect { get; set; }
public SolidColorBrush BgSelect { get; set; }
public SolidColorBrush FgSelect { get; set; }
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
switch (ButtonType)
{
case ButtonType.Normal:
BgUnselect = (SolidColorBrush)FindResource("Normal_bg_Unselect");
FgUnselect = (SolidColorBrush)FindResource("Normal_fg_Unselect");
BgSelect = (SolidColorBrush)FindResource("Normal_bg_Select");
FgSelect = (SolidColorBrush)FindResource("Normal_fg_Select");
return;
case ButtonType.OK:
case ButtonType.Cancel:
return;
}