我想为我的窗口中FontSize的所有s 设置(例如)。Hyperlink这是我MainWindow的XAML内容:
<Window.Resources>
<Style TargetType="{x:Type Hyperlink}">
<EventSetter Event="Click" Handler="Hyperlink_OnClick"/>
<Setter Property="FontSize" Value="30"></Setter>
</Style>
</Window.Resources>
<Grid>
<RichTextBox>
<FlowDocument>
<Paragraph>
something
<Hyperlink>
<Hyperlink.Inlines>
clickable
</Hyperlink.Inlines>
</Hyperlink> ...
</Paragraph>
</FlowDocument>
</RichTextBox>
</Grid>
如果我明确添加样式,它会起作用...(即添加x:Key="HyperlinkStyle"到Style标签,然后添加Style="HyperlinkStyle"到Hyperlink)
如何自动将样式设置为 all Hyperlinks ?
编辑:
@keyboardP、@Anatoliy 和 @kmatyaszek - 你很好......谢谢大家!我终于把Style标签移到了<RichTextBox.Resources>房产上。