有没有什么方法可以在LinqPad中正确实例化WPF对象?下面是我的示例(正确的组件在查询中添加等):在LinqPad中创建WPF示例
var w = new Window();
w.Loaded += (o,e) => {
w.Content = new TextBlock() { Text = "Foo" };
};
w.Show();
然而,这死一个可怕的死亡:
System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used.
at System.Windows.Input.TextServicesContext.StopTransitoryExtension()
at System.Windows.Input.TextServicesContext.Uninitialize(Boolean appDomainShutdown)
at System.Windows.Input.TextServicesContext.TextServicesContextShutDownListener.OnShutDown(Object target, Object sender, EventArgs e)
at MS.Internal.ShutDownListener.HandleShutDown(Object sender, EventArgs e)
我如何能得到这个工作的任何线索?
更新:这是固定在最近LINQPad测试版 - 您可以显示WPF窗口你想要的任何方式没有可怕的死亡:)你也可以执行以下操作,在输出面板中显示一个WPF元素:PanelManager.DisplayWpfElement(new TextBlock(){Text =“Foo”}); – 2012-03-09 13:01:39