ビューモデルにバインドする一連のスタイルがあります。これは、背景と前景でうまく機能します。私は今、フォントサイズをバインドしたいと思っています。バインディングを機能させることはできますが、値を変更してそのプロパティの PropertyChanged を呼び出すと、新しい値が取得されません。何か案は?
サンプル.xaml
<Style x:Key="ApplicationNameStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource NavigationForegroundColorBrush}"/>
<Setter Property="FontSize" Value="{Binding FontSize12, Source={StaticResource Sampe}}"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Margin" Value="0,2,0,0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect BlurRadius="10" Opacity="0.25" ShadowDepth="0"/>
</Setter.Value>
</Setter>
</Style>
sampleviewmodel.cs
public Double FontSize12
{
get
{
return _fontSize12;
}
set
{
_fontSize12 = value;
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs("FontSize12"));
}
}