原文:从PRISM开始学WPF(番外)共享上下文 RegionContext?

RegionContext共享上下文

There are a lot of scenarios where you might want to share contextual information between the view that is hosting a region and a view that is inside a region. For example, a master detail–like view shows a business entity and exposes a region to show additional detail information for that business entity. The Prism Library uses a concept named RegionContext to share an object between the host of the region and any views that are loaded inside the region, as shown in the following illustration.

(⊙﹏⊙)Google一下!

有很多场景可能需要在托管区域的视图和区域内的视图之间共享上下文信息。例如,类似主细节的视图显示一个业务实体并公开一个区域以显示该业务实体的附加详细信息。Prism使用一个名为RegionContext的概念在该区域的主机和该区域内加载的任何视图之间共享一个对象,如下图所示。

大意就是,在父视图中,添加一个Region,用来显示扩展信息,并且指定这个Region的DataContext(但是官方说This approach is somewhat similar to the DataContext, but it does not rely on it.),也就是说,仅仅是像而已!也就是说,不不用再为这个即将加载进来的视图,单独设置DataContext,任何一个加载进来的视图都共享这个RegionContext。

  1. <Grid x:Name="LayoutRoot" Background="White" Margin="10">
  2. <Grid.RowDefinitions>
  3. <RowDefinition Height="100"/>
  4. <RowDefinition Height="Auto"/>
  5. </Grid.RowDefinitions>
  6. <ListBox x:Name="_listOfPeople" ItemsSource="{Binding People}"/>
  7. <ContentControl Grid.Row="1" Margin="10"
  8. prism:RegionManager.RegionName="PersonDetailsRegion"
  9. prism:RegionManager.RegionContext="{Binding SelectedItem, ElementName=_listOfPeople}"/>
  10. </Grid>

从PRISM开始学WPF(番外)共享上下文 RegionContext?的更多相关文章

  1. 从PRISM开始学WPF,Prism7更新了什么

    当时我在搬运Prism6.3的sample代码的时候,就是因为网上的资料太老旧,万万没想到这给自己挖了一个坑,因为我在做笔记的时候,prism已经在更新7.0了 现在已经是7.2了,(lll¬ω¬), ...

  2. 从PRISM开始学WPF(八)导航Navigation-更新至Prism7.1

    原文:从PRISM开始学WPF(八)导航Navigation-更新至Prism7.1 0x6Navigation [7.1updated] Navigation 在wpf中并没有变化 Basic Na ...

  3. 从PRISM开始学WPF(七)MVVM(三)事件聚合器EventAggregator-更新至Prism7.1

    原文:从PRISM开始学WPF(七)MVVM(三)事件聚合器EventAggregator-更新至Prism7.1 事件聚合器EventAggregator [7.1updated]除了app部分,没 ...

  4. 从PRISM开始学WPF(一)WPF-更新至Prism7.1

    原文:从PRISM开始学WPF(一)WPF-更新至Prism7.1 我最近打算学习WPF ,在寻找MVVM框架的时候发现了PRISM,在此之前还从一些博客上了解了其他的MVVM框架,比如浅谈WPF中的 ...

  5. 从PRISM开始学WPF(一)WPF?

    从PRISM开始学WPF(一)WPF?   我最近打算学习WPF ,在寻找MVVM框架的时候发现了PRISM,在此之前还从一些博客上了解了其他的MVVM框架,比如浅谈WPF中的MVVM框架--MVVM ...

  6. 从PRISM开始学WPF(八)导航Navigation?

    原文:从PRISM开始学WPF(八)导航Navigation? 0x6Navigation Basic Navigation Prism中的Navigation提供了一种类似导航的功能,他可以根据用户 ...

  7. 从PRISM开始学WPF(七)MVVM(三)事件聚合器EventAggregator?

    原文:从PRISM开始学WPF(七)MVVM(三)事件聚合器EventAggregator? 从PRISM开始学WPF(一)WPF? 从PRISM开始学WPF(二)Prism? 从PRISM开始学WP ...

  8. 从PRISM开始学WPF(番外)共享上下文 RegionContext-更新至Prism7.1

    RegionContext共享上下文 There are a lot of scenarios where you might want to share contextual information ...

  9. 从PRISM开始学WPF

    我最近打算学习WPF ,在寻找MVVM框架的时候发现了PRISM,在此之前还从一些博客上了解了其他的MVVM框架,比如浅谈WPF中的MVVM框架--MVVMFoundation 中提到的MVVMFou ...

随机推荐

  1. com.octo.captcha.service.CaptchaServiceException: Invalid ID, could not validate unexisting o

    <p style="margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;"& ...

  2. 为什么 qt 成为 c++ 界面编程的第一选择?

    为什么qt成为c++界面编程的第一选择 一.前言 为什么现在QT越来越成为界面编程的第一选择,笔者从事qt界面编程已经有接近8年,在这之前我做C++界面都是基于MFC,也做过5年左右.当时为什么会从M ...

  3. php实现 字符个数统计

    php实现 字符个数统计 一.总结 一句话总结: 1.php字符转ascii码函数? ord() 6 if(ord($input[$i]) < 128 and 0 < ord($input ...

  4. Facial keypoints detection Kaggle 竞赛系列

    3.2# Facial keypoints detection 作者:Stu. Rui QQ: 1026163725 原文链接:http://blog.csdn.net/i_love_home/art ...

  5. 适合前端开发的 Chrome 扩展有哪些?(十款)

    适合前端开发的 Chrome 扩展有哪些?(十款) 一.总结 好的插件或者框架对程序员的意义重大. 二.适合前端开发的 Chrome 扩展有哪些?(十款) 掘金是一个高质量的技术社区,从 ECMASc ...

  6. 从0到1打造直播 App(直播流程介绍整理 <mark><转>)

    注明:原创 2016-10-27 李智文 腾讯Bugly 概要 分享内容: 互联网内容载体变迁历程,文字——图片/声音——视频——VR/AR——……..从直播1.0秀场时代(YY),2.0游戏直播(斗 ...

  7. java中抽象类和空的方法体有什么区别?

    public abstract void test();抽象方法public void test(){};方法体为空这两个有什么区别? public abstract void test(); 抽象方 ...

  8. DesignPattern_Java:SingletonPattern

    单例模式 SingletonPattern Ensure a class has only one instance,and provide a global point of access to i ...

  9. 使用Redis做产品统计的两种模式

    http://zihua.li/2012/07/two-patterns-of-statistics-using-redis/ 产品运行过程中及时记录收集并分析统计数据对产品的持续改进有重要的指导作用 ...

  10. 【BZOJ 1022】 [SHOI2008]小约翰的游戏John

    [题目链接]:http://www.lydsy.com/JudgeOnline/problem.php?id=1022 [题意] [题解] 和这题类似http://blog.csdn.net/harl ...