Search code examples
wpfxamlflowdocument

Disable Zoom in FlowDocument


In flow documents there's this ugly zoom "feature" that you can zoom in and out. I searched and I found this to remove it:

<FlowDocumentScrollViewer VerticalScrollBarVisibility="Hidden" FontSize="40">
        <FlowDocument>
            <!--content-->
        </FlowDocument>
</FlowDocumentScrollViewer>

But you can still zoom with Ctrl+MouseWheel. Is there anything I can do to disable this?


Solution

  • You can set MinZoom and MaxZoom to 100:

    <FlowDocumentScrollViewer VerticalScrollBarVisibility="Hidden"
                                FontSize="40" MinZoom="100" MaxZoom="100">
        <FlowDocument>
                <Paragraph>
                    <Bold>Some bold text in the paragraph.</Bold>
                    Some text that is not bold.
                </Paragraph>
    
                <List>
                    <ListItem>
                        <Paragraph>ListItem 1</Paragraph>
                    </ListItem>
                    <ListItem>
                        <Paragraph>ListItem 2</Paragraph>
                    </ListItem>
                    <ListItem>
                        <Paragraph>ListItem 3</Paragraph>
                    </ListItem>
                </List>
        </FlowDocument>
    </FlowDocumentScrollViewer>