Instable focus of WPF apps

后端 未结 2 2023
长发绾君心
长发绾君心 2021-01-15 10:15

If I have problems with WPF, then it always concerns the Focus-Management. There are cases, my App loses totally focus so that another application gains the focus an

相关标签:
2条回答
  • 2021-01-15 11:13

    +1 As I have also faced similar issues in my application. I am working on a VS like application(user can add(from toolbox) and configure controls in a Canvas) and focus is lost mysteriously after various commnads are executed like Delete etc. I have to use Canvas.Focus() explicitly to reset the focus and that too doesn't work sometimes.

    0 讨论(0)
  • 2021-01-15 11:14

    For losing focus for the entire app make sure you set the Owner property on all windows before you show them.

    For losing focus inside the app, usually this happens when some control you didn't think off is getting but not showing anything (for example some random StackPanel or Grid used for layout), you have to hunt those down and add Focusable="false"

    0 讨论(0)
提交回复
热议问题