Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.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
Silverlight 在包含相同区域的多个视图之间共享棱柱视图_Silverlight_Prism_Silverlight 5.0_Prism 4 - Fatal编程技术网

Silverlight 在包含相同区域的多个视图之间共享棱柱视图

Silverlight 在包含相同区域的多个视图之间共享棱柱视图,silverlight,prism,silverlight-5.0,prism-4,Silverlight,Prism,Silverlight 5.0,Prism 4,我试图实现以下模式,其中ContentRegion可以随时加载/激活ModuleShellView或ModuleShellView Module2ShellView没有对View1的引用,但由于View1已注册到Region1,因此当该视图加载到ContentRegion时,它将加载到Module2ShellView中,但我希望两个ModuleShellView共享同一个View1实例 我希望能够在两个模块ShellView之间切换 MainShell --ContentRegion ----M

我试图实现以下模式,其中ContentRegion可以随时加载/激活ModuleShellView或ModuleShellView

Module2ShellView没有对View1的引用,但由于View1已注册到Region1,因此当该视图加载到ContentRegion时,它将加载到Module2ShellView中,但我希望两个ModuleShellView共享同一个View1实例

我希望能够在两个模块ShellView之间切换

MainShell
--ContentRegion
----ModuleShellView
------Region1
--------View1
----Module2ShellView
------Region1
--------View1

根据我的理解,您希望
View1
实例可用于
moduleshellview
。一种方法是将
View1
注册为容器中的Singleton,因此每次加载
View1
时,容器将始终返回相同的实例

您可以在以下指南章节中找到有关查看注册的更多相关信息:

实现此场景的另一种替代方法是将
View1
与执行
ContentRegion
导航的
ContentRegion
分离。下面是一个可能的视图树
设计,它使视图1远离卸载和装载:

MainShell:
* Region1
  - View1
* ContentRegion
  - ModuleShellView
  - Module2ShellView
我希望这有帮助