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();

 

 

 

 

 

 

posted @ 2013-04-13 13:03  I'm CY  阅读(491)  评论(0编辑  收藏  举报