FlowDocumentScrollViewer FontSize不会更改FlowDocument内容FontSize

时间:2013-03-18 09:14:44

标签: c# wpf xaml flowdocument flowdocumentscrollviewer

任何人都可以解释为什么以下代码不起作用

<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而且我无法弄清楚出了什么问题

2 个答案:

答案 0 :(得分:2)

嗨,我再次遇到同样的问题,我能够解决这个问题

您可以简单地更改使用样式,但仅限于FontSize未修复

无效

    <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>

答案 1 :(得分:0)

拿这个:

        <FlowDocumentScrollViewer >
            <FlowDocument FontSize="50">
                <Paragraph>
                    this text should be FontSize 56
                </Paragraph>
            </FlowDocument>
        </FlowDocumentScrollViewer>