|
|
Is it possible to make the Main Window Not resizable?
Thanks for your support.
|
|
Coordinator
Oct 29, 2012 at 8:27 AM
|
Yes, there's an property "Resizable" that you can set in code behind (e.g. the Constructor) in order to make the window not resizable.
|
|
|
|
Thanks for your quick answer.
Anyways, if I set this property at markup level (XAML) it is ignored and if I do this programmatically (at constructor level), the app throws a TargetInvocationException .
This is the place where I put the line inside the constructor:
InitializeComponent();
Kernel.Instance.Controller.SetRootFrame(ContentFrame);
Resizeable = false; // Throws an exception
Any suggestions?
Thanks again...
|
|
Coordinator
Nov 1, 2012 at 3:12 PM
|
Hi Jsaer,
sorry for the late reply, but I wanted to be sure that the workaround works.
1.) You have to add an Loaded Event to your main window.
Loaded="OnLoaded"
2.) You have to implement the OnLoaded Method at your code behind file.
public MainWindow()
{
InitializeComponent();
Kernel.Instance.Controller.SetRootFrame(ContentFrame);
}
public void OnLoaded(object sender, EventArgs args)
{
Resizeable = false;
}
Cheers
- Gerhard
|
|
|
|
Thanks for your answer, this seems force the value properly now. However I have noticed something:
If you maximize and restore the window, where Resizeable is False, at some point the value is reset and the window becomes resizeable again.
I know I could work on this by hooking another event(s) , but this couldn't represent so much work . Do you agree with me?
Thanks again for your support.
Jorge
|
|