Application.Current in ElementHost is null

前端 未结 1 987
孤城傲影
孤城傲影 2021-01-01 16:48

I use a WPF UserControl in my personal Libs. The Libs are included in my WPF and WindowsForms programs. Now my UserControl has to show a new (WPF) Window. At the new Window

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

    Application.Current is Specific for WPF Application.
    Therefore when you are using WPF controls in WinForms Application you need to initialize instance of WPF Application. Do this in your WinForms Application.

    if ( null == System.Windows.Application.Current )
    {
       new System.Windows.Application();
    } 
    
    0 讨论(0)
提交回复
热议问题