Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: WPF
I have a window with the following properties:
ShowInTaskbar="False" WindowStyle="None" ResizeMode="NoResize" Topmost="True" AllowsTransparency="True" Background="Transparent"
and I want to maximize the window after pressing a button with the following line:
this.WindowState = System.Windows.WindowState.Maximized;
in doing so, the window is positioned me in the upper left but it is not maximized.
also tested with the following lines but did not work:
this.Height = SystemParameters.MaximizedPrimaryScreenHeight;
this.Width = SystemParameters.MaximizedPrimaryScreenWidth;
this.Top = 0; this.Left = 0;
Anyone know how to solve it?
Thank you very much.
Posted 2-Jan-13 6:00am
Edited 2-Jan-13 6:04am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Looks strange. Is so, I would temporary modified resize mode and them maximized. You may also need to handle the event StateChanged or override the virtual protected method StateChanged, to make sure you have the same ResizeMode when you change the WindowState again, either by assigning a new value to it, calling, for example RestoreBounds or by the UI user. Please see:[^],[^];
see also:[^],[^],[^].
Good luck,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 275
1 DamithSL 265
2 CPallini 235
3 Maciej Los 185
4 George Jonsson 170
0 OriginalGriff 5,415
1 DamithSL 4,422
2 Maciej Los 3,820
3 Kornfeld Eliyahu Peter 3,470
4 Sergey Alexandrovich Kryukov 2,911

Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100