Between the Lines
6Sep/090

Just a Bit: Make Your WPF Application Resolution and DPI Independent

We've all seen it. Lower your resolution to 800x600? The application's UI is giant, hard to navigate, and ugly. Bring it up to 1920x1200? 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>

Related posts:

  1. Sending Commands/Events to Another Application
  2. Introduction to Threads
  3. Threading Complexities
  4. Multithreading in WPF
  5. Just a Bit: Improving Graphics Card Performance
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.