I need to enable the following on my application (C# WPF application):
There isn't any ResizeMode
the fulfills all of those requirements. Is there any way to do do?
I've finally found a relatively decent solution.
The idea is to overide the OnStateChanged
event of the window, cancel the Min/Max constraints and refresh it.
If the window is not maximized, we simply apply back the Min/Max constraints
protected override void OnStateChanged(EventArgs e)
{
if (WindowState == WindowState.Maximized)
{
MinWidth = 0;
MinHeight = 0;
MaxWidth = int.MaxValue;
MaxHeight = int.MaxValue;
if (!m_isDuringMaximizing)
{
m_isDuringMaximizing = true;
WindowState = WindowState.Normal;
WindowState = WindowState.Maximized;
m_isDuringMaximizing = false;
}
}
else if (!m_isDuringMaximizing)
{
MinWidth = 1024;
MinHeight = 768;
MaxWidth = 1024;
MaxHeight = 768;
}
base.OnStateChanged(e);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With