Prism Sample 6 Activation Deactivation
例5中刚说到视图精确控制,这次说明这样的灵活控制是怎样做的,显示或不显示,或切换视图。
主页上显示了主按钮和一个ContentControl
<DockPanel LastChildFill="True">
<StackPanel>
<Button Content="Activate ViewA" Click="Button_Click"/>
<Button Content="Deactivate ViewA" Click="Button_Click_1"/>
<Button Content="Activate ViewB" Click="Button_Click_2"/>
<Button Content="Deactivate ViewB" Click="Button_Click_3"/>
</StackPanel>
<ContentControl prism:RegionManager.RegionName="ContentRegion" HorizontalAlignment="Center" VerticalAlignment="Center" />
</DockPanel>
然后在后台代码中,对显示内容进行了精确控制
public partial class MainWindow : Window
{
IContainerExtension _container;
IRegionManager _regionManager;
IRegion _region; ViewA _viewA;
ViewB _viewB; public MainWindow(IContainerExtension container, IRegionManager regionManager)
{
InitializeComponent();
_container = container;
_regionManager = regionManager; this.Loaded += MainWindow_Loaded;
} private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
_viewA = _container.Resolve<ViewA>();
_viewB = _container.Resolve<ViewB>(); _region = _regionManager.Regions["ContentRegion"]; _region.Add(_viewA);
_region.Add(_viewB);
} private void Button_Click(object sender, RoutedEventArgs e)
{
//activate view a
_region.Activate(_viewA);
} private void Button_Click_1(object sender, RoutedEventArgs e)
{
//deactivate view a
_region.Deactivate(_viewA);
} private void Button_Click_2(object sender, RoutedEventArgs e)
{
//activate view b
_region.Activate(_viewB);
} private void Button_Click_3(object sender, RoutedEventArgs e)
{
//deactivate view b
_region.Deactivate(_viewB);
}
}
这里出现的新概念就是Activate 和DeActivate。控制显示和不显示。
Prism Sample 6 Activation Deactivation的更多相关文章
- WPF Prism Request Navigate activation error
其他测试项目时没有问题,但是有些项目有时候导航一直报错误! Referring the StockTraderRI, I created a popup region in my shell infB ...
- C# 一个基于.NET Core3.1的开源项目帮你彻底搞懂WPF框架Prism
--概述 这个项目演示了如何在WPF中使用各种Prism功能的示例.如果您刚刚开始使用Prism,建议您从第一个示例开始,按顺序从列表中开始.每个示例都基于前一个示例的概念. 此项目平台框架:.NET ...
- Android 主题动态切换框架:Prism
Prism(棱镜) 是一个全新的 Android 动态主题切换框架,虽然是头一次发布,但它所具备的基础功能已经足够强大了!本文介绍了 Prism 的各种用法,希望对你会有所帮助,你也可以对它进行扩展, ...
- [转]Blue Prism Architecture
本文转自:https://mindmajix.com/blue-prism-architecture Introduction Automation technology is widely bloo ...
- Caliburn.Micro 项目文档(翻译):Screens, Conductors and Composition
原文地址(项目说明文档):[Documentation Screens, Conductors and Composition]http://caliburnmicro.codeplex.com/w ...
- wordpress钩子和钩子函数
ccc,看了很多博客,无法理解,还是自己来写吧. wordpress 在wordpress中有很多钩子,还有很多钩子函数,在什么地方用什么钩子,用什么钩子函数, 需要明白两个问题: 1:什么是钩子,钩 ...
- Mono addin 学习笔记 1
Mono Addin是一个开源的插件框架,其主要支持的特性如下: The main features of Mono.Addins are: Supports descriptions of add- ...
- Sharepoint学习笔记—习题系列--70-573习题解析 -(Q115-Q117)
Question 115You create a timer job.You need to debug the timer job.To which process should you attac ...
- Sharepoint学习笔记—习题系列--70-573习题解析 -(Q40-Q44)
Question 40You need to send a single value from a consumer Web Part to a provider Web Part.Which int ...
- AvalonDock 2.0+Caliburn.Micro+MahApps.Metro实现Metro风格插件式系统(菜单篇)
这章主要说插件的菜单,可以说菜单是最核心的部分,前面我们已经实现了Document添加,现在主要就是生成具有层级关系的菜单,以及把菜单跟我们自定义的Document关联起来,也就是MenuPart-& ...
随机推荐
- linux 安装 jupyter notebook
虚拟机使用的是ubuntu系统 直接遇见一个问题 E: 无法获得锁 /var/lib/dpkg/lock - open (11: 资源暂时不可用) E: 无法锁定管理目录(/var/lib/dpkg/ ...
- Json对象转换模块(自编代码JsonObject.cs)
namespace 信息采集系统.Common { /// <summary> /// Json类型对象,用于其它Json对象继承 /// </summary> /// < ...
- 2020.11.14 typeScript声明空间
在ts中存在两种声明空间: 类型声明空间和变量声明空间. 类型声明空间: 1. class People {} 2. interface People {} 3. type People = {} 变 ...
- linux查看mac地址
1. ip addr show (ip address show .ip addr ) 查看本机ip和额外的一些信息 2.ifconfig -a 其中 HWaddr 就是mac地址 3.cat /s ...
- SpringBoot整合RocketMQ案例实战
一.概念 rocketMQ是一款典型的分布式架构下的中间件产品,使用异步通信方式和发布订阅的消息传输模型,具备异步通信的优势,系统拓扑简单,上下游耦合较弱,主要应用于异步解耦,流量削峰填谷等场景 二. ...
- linux网络编程中的errno处理
在Linux网络编程中,errno是一个非常重要的变量.它记录了最近发生的系统调用错误代码.在编写网络应用程序时,合理处理errno可以帮助我们更好地了解程序出现的问题并进行调试. 通常,在Linux ...
- Unity C# IEnumrator 与 async 有的区别
前言 IEnumerator 和 async 是在 Unity 和 C# 中处理异步编程的两种不同方法.它们各自有不同的使用场景和优缺点. IEnumerator IEnumerator 是 C# 中 ...
- VW
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- 火山引擎 A/B 测试产品——DataTester 私有化架构分享
作为一款面向 ToB 市场的产品--火山引擎A/B测试(DataTester)为了满足客户对数据安全.合规问题等需求,探索私有化部署是产品无法绕开的一条路. 在面向 ToB 客户私有化的实际落地中,火 ...
- [大数据]sqoop安装与运用
1 文由 项目使用场景:OLTP Oracle 数据导入到 OLAP HIVE 2 Sqoop简述 Apache Sqoop(TM) 是一款开源的ETL工具,设计用于在 Apache Hadoop和结 ...