の Resources セクションの一部としてStyle指定された forがあります。ParagraphFlowDocumentReader
<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にロードされた場合にのみ問題になるようです。FlowDocumentReaderXAML がFlowDocumentReader.xaml ファイルの内に明示的に配置されている場合、Foregroundは正しい色でありFontSize、プロパティの設定に基づいて変更されます。
アイデア?
解決済み:
以下の回答で書いたように、Styleブロックをリソースセクションに移動FlowDocumentすると、問題が解決します。