Hi folks,
changing a static resource during runtine is something that sounds not possible.
I have a TextBox which displays a simple number. Then I have defined a style, which changes the Template of the TextBox to become a round TextBox:
<Style x:Key="RoundNumberDisplay" TargetType="TextBox">
<Setter Property="Width" Value="22"/>
<Setter Property="Height" Value="22"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Border x:Name="brd1" Width="20" Height="20" CornerRadius="15">
<TextBlock x:Name="txt1" Foreground="#222" TextAlignment="center" Text="1" FontSize="14" FontWeight="ExtraBold" VerticalAlignment="center" />
<Border.Background>
<RadialGradientBrush GradientOrigin=".3, .3">
<GradientStop Color="{StaticResource ColorBackground1}" Offset=".15"/>
<GradientStop Color="{StaticResource ColorForeground1}" Offset="1"/>
</RadialGradientBrush>
</Border.Background>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
As you can see, the displayed text is "hard-wired" in the TextBlock "txt1". So obviously, I can't change the number during runtime.
My question now is: What is the best way to change the displayed number? Creating a Style for each number looks a bit ineffective to me.
Thanks in advance, Frank