Reputation: 119
I am writing a small application to remind me of up coming events. It normally sits in the bottom right corner of the screen and cannot be resized or moved. I want a menu item to allow the user to resize and move the window. I am able to do the resizing by using the statement:
Application.Current.MainWindow.ResizeMode = ResizeMode.CanResize;
I cannot get it to move. In the MainWindow function I set the Window Style to None:
this.WindowStyle = System.Windows.WindowStyle.None;
In the Move method, triggered from the menu, I set the Window style to Single border:
Application.Current.MainWindow.Style = System.WindowStyle.SingleBorderWindow;
However, when this instruction is processed the window style stays as None.
How can I change the Window style dynamically?
Upvotes: 0
Views: 1180
Reputation: 683
Application.Current.MainWindow.Style = System.WindowStyle.SingleBorderWindow;
This line should have given you a compilation error, since you are trying to assign two different types, and should have set instead:
Application.Current.MainWindow.WindowStyle = System.WindowStyle.SingleBorderWindow;
Upvotes: 1