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
Post a Comment