Why is Keyboard.FocusedElement null when focus is inside WindowsFormsHost? It breaks WPF command routing

前端 未结 1 1292
无人及你
无人及你 2021-01-05 10:56

I have a custom RoutedUICommand MyCommand which gets executed via ICommand.Execute. The top window has a binding to handle it:



        
相关标签:
1条回答
  • 2021-01-05 11:34

    To complete the interop Form-WPF you need to do this:

    App.xaml.cs:

        public partial class App : Application
          {
          protected override void OnStartup(StartupEventArgs e)
            {
            WindowsFormsHost.EnableWindowsFormsInterop();
            base.OnStartup(e);
            }
          }
    
    0 讨论(0)
提交回复
热议问题