Click here to Skip to main content
15,919,245 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am new to WPF Application development and got a problem right on the first day of development, the problem is that my form is maximizing only horizontally and not vertically, i've tried what i knew but still there is no progress. Can anyone help me with a work around here?

Below is the thing that i am trying to achieve programmatically. (Obviously on click of maximize button)
(mw is the name of "MainWindow").
mw.WindowState = WindowState.Maximized;

i've tried the code below this line but no progress
mw.MaxWidth = SystemParameters.MaximizedPrimaryScreenWidth;
Updated 18-Apr-12 22:58pm

1 solution

Set the Height of the window to Auto in your xaml.
That should allow you to maximize to full height vertically.
Share this answer
AtifImtiaz 19-Apr-12 6:06am    
omg, that solved it, i also added VerticalAlignment="Strech" with this. and that solved the problem. thanx for it dude. will be back with another problem in a while :)
Fredric Jerin 22-Sep-21 0:18am    
Thank you. It worked.

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