vsto 解决 wpf 的 input 的问题

就两行代码,弄了我一天,上火

    [Export(typeof(IWindowManager))]
    public class AddInWindowManager : WindowManager
    {
        protected override System.Windows.Window EnsureWindow(object model, object view, bool isDialog)
        {
            var window = base.EnsureWindow(model, view, isDialog);
            window.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            if (model is IAddinWindow)
            {
                WindowInteropHelper helper = new WindowInteropHelper(window);
                helper.Owner = new IntPtr(Globals.ThisAddIn.Application.Hwnd);
                window.Closed += (sender, e) => System.Windows.Threading.Dispatcher.ExitAllFrames();
            }
            return window;
        }
    }

 

            var w = IoC.Get<IWindowManager>();
            w.ShowWindow(rootModel, context, settings);
            System.Windows.Threading.Dispatcher.Run();

 

 

 

 

 

 

你可能感兴趣的:(vsto 解决 wpf 的 input 的问题)