Click here to Skip to main content
12,355,050 members (39,026 online)
Rate this:
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 5:00am
Edited 2-Jan-13 5: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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.160621.1 | Last Updated 2 Jan 2013
Copyright © CodeProject, 1999-2016
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