0

I used the shortcut to minimize the window, but I don't know how to restore it.

private void Window_KeyDown(object sender, KeyEventArgs e)
    {
        switch (e.Key)
        {
            case Key.F1:
                    WindowState = WindowState.Minimized;
                break;
            case Key.F2:
                    WindowState = WindowState.Normal;
                break;
        }
    }
  • You will need low level windows keyboard hook or global hotkey, however it does raise the issue, what if you are in another application that uses the keyboard shotcut as well. – TheGeneral Aug 20 '19 at 05:17
  • @TheGeneral I tagged wpf, not Winform. I raised the question of how to do wpf, not the question of how to do winform. But I found a way to do wpf on a website. –  Aug 20 '19 at 06:39
  • There is no difference, neither wpf or winforms will have access to keyboard events when its minimised. thats why you need to hook – TheGeneral Aug 20 '19 at 06:41
  • @TheGeneral I am well aware of that. However, winform says it supports handlers, but wpf does not. It took me time in that part. –  Aug 20 '19 at 06:43
  • 1
    I dont have the time to help you at this moment, ill remove the duplicates – TheGeneral Aug 20 '19 at 06:45
  • @TheGeneral But thanks to your duplicates, I've got my bearings. Thank you. –  Aug 20 '19 at 06:47

0 Answers0