Question

could anybody please explain my why the following code doesn't work

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

as you can see the FontSize isn't 56 and i can't figure out what's wrong

Was it helpful?

Solution

Hi after i run in the same issue again i was able to work this out

you can simple change that be using style but only if the FontSize isn't fixed

Won't work

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

Will work

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

OTHER TIPS

take this:

        <FlowDocumentScrollViewer >
            <FlowDocument FontSize="50">
                <Paragraph>
                    this text should be FontSize 56
                </Paragraph>
            </FlowDocument>
        </FlowDocumentScrollViewer>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top