FlowDocumentScrollViewer的字体大小不会改变FlowDocument内容的字体大小
本文关键字:字体 FlowDocument FlowDocumentScrollViewer 改变 | 更新日期: 2023-09-27 18:04:20
谁能解释一下为什么下面的代码不工作
<UserControl x:Class="FlowDocReader.FlowDocumentScrollViewerIssues"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<FlowDocumentScrollViewer FontSize="56">
<FlowDocument>
<Paragraph>
this text should be FontSize 56
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
</UserControl>
你可以看到FontSize
不是56,我不知道是什么问题
嗨,在我再次运行相同的问题后,我能够解决这个问题
你可以简单地改变使用样式,但只有当字体大小不是固定的
行不通
<FlowDocumentScrollViewer FontSize="56">
<Style TargetType="{x:Type FlowDocument}">
<Setter Property="FontSize" Value="56"/>
</Style>
<FlowDocument FontSize="56">
<Paragraph>
this text should be FontSize 56
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
<FlowDocumentScrollViewer FontSize="56">
<Style TargetType="{x:Type FlowDocument}">
<Setter Property="FontSize" Value="56"/>
</Style>
<FlowDocument>
<Paragraph>
this text should be FontSize 56
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
take this:
<FlowDocumentScrollViewer >
<FlowDocument FontSize="50">
<Paragraph>
this text should be FontSize 56
</Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>