Click here to Skip to main content
15,891,762 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, how do I simply Zoom out a window wpf. I do not want any slider control, all I want is the window to be zoomed out when program is executed. I would appreciate a piece of code for that in XAML.

I am using VS 2010 with .NET 3.5.

Thank you.
Posted

1 solution

Simply wrapping your XAML content in a Viewbox will automatically zoom the contents out so they all fit in the viewable area:
XML
<Viewbox>
    <!-- Your content here -->
</Viewbox>


Simple as that. If you want to Zoom out dynamically or to a specific amount then you can use a ScaleTransform:
XML
<Grid>
    <Grid.RenderTransform>
        <ScaleTransform ScaleX="0.5" ScaleY="0.5" CenterX="0.5" CenterY="0.5" />
    </Grid.RenderTransform>
    <!-- Your content here -->
</Grid>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900