We’ve all seen it. Lower your resolution to 800×600? The application’s UI is giant, hard to navigate, and ugly. Bring it up to 1920×1200? Now, you can’t see it. Here’s an easy way to make your application’s content size relative to your window’s size (which will lead it to size independently of the resolution or DPI).
All you have to do is surround your content in a Viewbox, with a uniform Stretch (to ensure the aspect ratio is maintained). You may need to specify a particular size for your content, in order to ensure proper aspect ratio and distance for your elements.
<Viewbox Stretch="Uniform"> <Grid Width="800" Height="600"> <!-- Content --> </Grid> </Viewbox> |
Please let me know if you’re looking for a article writer for your site. You have some really great posts and I believe I would be a good asset. If you ever want to take some of the load off, I’d love to write some material for your blog in exchange for a link back to mine. Please shoot me an e-mail if interested. Cheers!