c# - Maximize Window and restore to normal in wpf -


hi want maximize window in wpf , use below lines:

private void mnu_maximize_click(object sender, routedeventargs e) {     if (main.windowstate == system.windows.windowstate.maximized)         main.windowstate = system.windows.windowstate.normal;     main.windowstate = system.windows.windowstate.maximized;  } 

but problem when click again restore window normal state it's not working , it's stuck in maximized state.
how can fix this?

add else part :

if (main.windowstate == system.windows.windowstate.maximized)     main.windowstate = system.windows.windowstate.normal; else     main.windowstate = system.windows.windowstate.maximized; 

updates:

in given code, conditional statement(if) doing nothing, in case main.windowstate set maximized. that's why told introduce else there.


Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

java - How to resolve The method toString() in the type Object is not applicable for the arguments (InputStream) -