[WPF] Resizing with WPF

J

J.F. Ronner

Hello,

I am working on a WPF application and I have an issue regarding
automatic resizing:

I use Visual Studio Express Edition to write the C# code and I
use Expression Blend for designing the application (XAML).

I am new to WPF and Expression Blend, so please bear with me... :)

My question is:

Can I add some code or modify some property that allows me to
have the controls in the form (or window) to automatically resize
when the window is resized? Let me explain this below:

I have come up with a C# function that uses a percentage to resize
the controls after the window has been resized with a certain
percentage,
but I think it can be done a lot easier (and better).

For example:

A window of 500x500 pixels contains a grid that contains a button.

Now I want that button to grow bigger or smaller if
the window has been resized (the button must be resized with the same
percentage).

I have read this:

http://msdn.microsoft.com/en-us/library/ms748828.aspx

But that was not very helpful. So if anyone can help me?


Thanks in advance.


Kind regards,

J.F. Ronner
 
F

fredm

Hello,

I am working on a WPF application and I have an issue regarding
automatic resizing:

I use Visual Studio Express Edition to write the C# code and I
use Expression Blend for designing the application (XAML).

I am new to WPF and Expression Blend, so please bear with me... :)

My question is:

Can I add some code or modify some property that allows me to
have the controls in the form (or window) to automatically resize
when the window is resized? Let me explain this below:

I have come up with a C# function that uses a percentage to resize
the controls after the window has been resized with a certain
percentage,
but I think it can be done a lot easier (and better).

For example:

A window of 500x500 pixels contains a grid that contains a button.

Now I want that button to grow bigger or smaller if
the window has been resized (the button must be resized with the same
percentage).

I have read this:

http://msdn.microsoft.com/en-us/library/ms748828.aspx

But that was not very helpful. So if anyone can help me?

Thanks in advance.

Kind regards,

J.F. Ronner

You specify the equivalent of a % with the * notation. This is used
when specifying content of an enclosing container. The following
links might help:
http://blog.richstern.com/?p=149
http://stackoverflow.com/questions/717299/wpf-setting-the-width-and-height-as-a-percentage-value
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

WinForm, WPF and WEB 2
C# and WPF 1
C# and WPF 2
WPF and some elements 2
WPF modaless dialog on Winforms. 4
WPF Navigation 2
WPF-style code 1
WPF application on Windows XP - first start takes forever 2

Top