Search code examples
c#wpfminimized

If i press right alt this hide, when i press again program shows and hide


            if (e.KeyData.ToString().ToUpper() == "RMENU")
            {
                if(alt==2)
                    WindowState = WindowState.Normal;
                    alt = 1;
                else
                    WindowState = WindowState.Minimized;
                    alt = 2;
            }

If i press right alt this hide, when i press again program shows and hide


Solution

  •     if (e.KeyData.ToString().ToUpper() == "RMENU")
        {
            if (alt == 2)
            {
                WindowState = WindowState.Normal;
                alt = 1;
            }
            else if (alt == 1)
            {
                WindowState = WindowState.Minimized;
                alt = 2;
            }
        }