の Resources セクションの一部としてStyle
指定された forがあります。Paragraph
FlowDocumentReader
<FlowDocumentReader>
<FlowDocumentReader.Resources>
<Style x:Key="myStyle" TargetType="{x:Type Paragraph}">
<Setter Property="Foreground" Value="LightSteelBlue" />
<Setter Property="BorderBrush" Value="LightSteelBlue" />
<Setter Property="BorderThickness" Value="1.0" />
<Setter Property="FontStyle" Value="Italic" />
<Setter Property="FontSize" Value="{Binding Path=MyFontSize}" />
</Style>
</FlowDocumentReader.Resources>
</FlowDocumentReader>
my を含む .xaml ファイルがあり、次のように定義されFlowDocument
ている s がいくつかあります。Paragraph
<Paragraph Style='{DynamicResource myStyle}">
Stuff here
</Paragraph>
私が抱えている問題はForeground
、テキストに適用されず (LightSteelBlue ではなく Black として表示される) 、プロパティが変更されFontSize
ても変更されないことです。MyFontSize
コード ビハインドでプロパティ値を確認しましたが、設定されていますが、UI に変更はありません。
これは、実行時FlowDocument
にロードされた場合にのみ問題になるようです。FlowDocumentReader
XAML がFlowDocumentReader
.xaml ファイルの内に明示的に配置されている場合、Foreground
は正しい色でありFontSize
、プロパティの設定に基づいて変更されます。
アイデア?
解決済み:
以下の回答で書いたように、Style
ブロックをリソースセクションに移動FlowDocument
すると、問題が解決します。