Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在wpf中设置根可视视图_Wpf_Prism - Fatal编程技术网

如何在wpf中设置根可视视图

如何在wpf中设置根可视视图,wpf,prism,Wpf,Prism,使用wpf设置根visual的正确方法是什么。在silverlight的例子中,我喜欢看它 ShellView视图=this.Container.TryResolve() Application.Current.RootVisual=view 似乎根可视化属性在wpf中不存在,我尝试了以下操作,但它没有加载我的shell视图(usercontrol) ShellView视图=this.Container.TryResolve(); Application.Current.MainWindow=W

使用wpf设置根visual的正确方法是什么。在silverlight的例子中,我喜欢看它
ShellView视图=this.Container.TryResolve()
Application.Current.RootVisual=view

似乎根可视化属性在wpf中不存在,我尝试了以下操作,但它没有加载我的shell视图(usercontrol)

ShellView视图=this.Container.TryResolve();
Application.Current.MainWindow=Window.GetWindow(视图);
在wpf中设置root visual的正确方法是什么?

由于您的问题有标签,您只需查看随Prism提供的StockTrader演示,它的引导程序中有以下几行:

protected override void InitializeShell()
{
base.InitializeShell();
#如果银光
Application.Current.RootVisual=(Shell)this.Shell;
#否则
Application.Current.MainWindow=(Shell)this.Shell;
Application.Current.MainWindow.Show();
#恩迪夫
}
创建shell的位置是
CreateShell()
覆盖,其中
shell
的类型为
Window

protected override DependencyObject CreateShell()
{
    return this.Container.TryResolve<Shell>();
}
protected override DependencyObject CreateShell()受保护的覆盖依赖对象
{
返回此.Container.TryResolve();
}
你不会得到比Prism演示中更“合适”的结果。

因为你的问题有标签,你只需看看Prism提供的StockTrader演示,它的引导程序中有以下几行:

protected override void InitializeShell()
{
base.InitializeShell();
#如果银光
Application.Current.RootVisual=(Shell)this.Shell;
#否则
Application.Current.MainWindow=(Shell)this.Shell;
Application.Current.MainWindow.Show();
#恩迪夫
}
创建shell的位置是
CreateShell()
覆盖,其中
shell
的类型为
Window

protected override DependencyObject CreateShell()
{
    return this.Container.TryResolve<Shell>();
}
protected override DependencyObject CreateShell()受保护的覆盖依赖对象
{
返回此.Container.TryResolve();
}
在Prism的演示中,你不会得到比它更“合适”的东西