Scaling application controls size according to surrounding container

Hi Friends,

While developing the application in Windows Presentation Foundation, you might face with issue of scaling the application. If you want to run your application into different display of different resolutions then you might need to scale up/down your application to regain the application controls at the right position as they were present before.

  • For the resolution Independence of application, you should place your into the ViewBox which defines a content decorator that can stretch and scale a single child to fill the available space.
  • In this way, whenever you will re-size the window, your application controls will also re-size with the same aspect ratio and automatically will get stretched and scaled properly.
  • If you are using Expression Blends, then a snapshot of Objects and Timeline is added for your referral as how to add the controls in viewbox.

  • In the figure above, Grid contains all the controls which are used inside the application and the same grid is placed inside the viewbox control which is included in the main window.

Enjoy 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s