本例是基础的导航应用

在窗口中布局了2个按钮,一个区域

 <DockPanel LastChildFill="True">
<StackPanel Orientation="Horizontal" DockPanel.Dock="Top" Margin="5" >
<Button Command="{Binding NavigateCommand}" CommandParameter="ViewA" Margin="5">Navigate to View A</Button>
<Button Command="{Binding NavigateCommand}" CommandParameter="ViewB" Margin="5">Navigate to View B</Button>
</StackPanel>
<ContentControl prism:RegionManager.RegionName="ContentRegion" Margin="5" />
</DockPanel>

其中2个按钮绑定了同一个命令,只是参数不同,即命令是导航,目标不同。

public DelegateCommand<string> NavigateCommand { get; private set; }

        public MainWindowViewModel(IRegionManager regionManager)
{
_regionManager = regionManager; NavigateCommand = new DelegateCommand<string>(Navigate);
} private void Navigate(string navigatePath)
{
if (navigatePath != null)
_regionManager.RequestNavigate("ContentRegion", navigatePath);
}

扩展模块定义了2个视图,用作导航的视图。要点是在模块中注册为导航视图。

 public class ModuleAModule : IModule
{
public void OnInitialized(IContainerProvider containerProvider)
{ } public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterForNavigation<ViewA>();
containerRegistry.RegisterForNavigation<ViewB>();
}
}

Prism Sample 17-BasicRegionNavigation的更多相关文章

  1. Android 主题动态切换框架:Prism

    Prism(棱镜) 是一个全新的 Android 动态主题切换框架,虽然是头一次发布,但它所具备的基础功能已经足够强大了!本文介绍了 Prism 的各种用法,希望对你会有所帮助,你也可以对它进行扩展, ...

  2. [转]Blue Prism Architecture

    本文转自:https://mindmajix.com/blue-prism-architecture Introduction Automation technology is widely bloo ...

  3. PHP数据结构预热:PHP的迭代器(转)

    迭代器有时又称光标(cursor)是程式设计的软件设计模式,可在容器物件(container,例如list或vector)上遍访的接口,设计人员无需关心容器物件的内容. 各种语言实作Iterator的 ...

  4. PRaCtice[1]

    目录 ID-3学习 代码实现 1. 样例数据集 2.信息熵的计算 ID-3学习 代码实现 该项目采用了业界领先的 TDD(TreeNewBee-Driven Development,吹牛逼导向开发模式 ...

  5. linux常用配置文件和命令总结

    常用配置文件说明: 1..设置-n永远生效:Vim的配置文件:命令模式想永久生效, ~/.vimrc,新建文件,在里面输入保存即可 2.设置别名永远生效:在~/.bashrc  修改当前用户家目录里的 ...

  6. 更准确的测试Java程序性能——JMH基准测试

    什么是JMH ​ JMH,即Java Microbenchmark Harness,Java平台下的一套微基准测试工具.如果我们需要测试API性能的话,就可以用上这个工具,所以它并不是取代单元测试的. ...

  7. 解决: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will raise ValueError in 0.19

    错误信息:C:\Python27\lib\site-packages\sklearn\utils\validation.py:395: DeprecationWarning: Passing 1d a ...

  8. Basic linux command-with detailed sample

    Here I will list some parameters which people use very ofen, I will attach the output of the command ...

  9. [转]simple sample to create and use widget for nopcommerce

    本文转自:http://badpaybad.info/simple-sample-to-create-and-use-widget-for-nopcommerce Here is very simpl ...

  10. [转] Spring MVC sample application for downloading files

    http://www.codejava.net/frameworks/spring/spring-mvc-sample-application-for-downloading-files n this ...

随机推荐

  1. 使用npm包API Promise化

  2. String当中的intern()

    public class String001 { public static void main(String[] args) { String s1 = "hello"; Str ...

  3. mac下webstrom卡顿快速解决办法

    vim /Applications/WebStorm.app/Contents/bin/webstorm.vmoptions 一路回车 直到看到: 按insert 将顶部以下两项原有值修改为以下值: ...

  4. Old ST-LINK firmware detected.do you want to upgrade it?升级固件

    一段时间没有使用st-link烧写程序了.打开keil5准备把程序烧写到stm32板子上时,报错Old ST-LINK firmware detected.do you want to upgrade ...

  5. 初识C 语言

    程序语言 C语言是目前极为流行的一种计算机程序设计语言,它既具有高级语言的功能,又具有汇编语言的一些特性.支持ANSIC. C语言的特点:通用性及易写易读 是一种结构化程序设计语言   具有良好的可移 ...

  6. Android Studio报错--Build failed with an exception.

    错误描述 在代码写好之后,点击运行,会爆出这样的错误,查看日志,发现是Manifest.xml文件爆出来的错误 具体解决 我的错误没有别的版本那么麻烦,就是我建立了Empty Activity之后,我 ...

  7. salesforce零基础学习(一百二十八)Durable Id获取以及相关概念浅入浅出

    本篇参考: salesforce 零基础开发入门学习(十一)sObject及Schema深入 https://developer.salesforce.com/docs/atlas.en-us.api ...

  8. Spring IOC——源码分析

    Spring 容器的 refresh() 创建容器 1 //下面每一个方法都会单独提出来进行分析 2 @Override 3 public void refresh() throws BeansExc ...

  9. 痞子衡嵌入式:恩智浦经典LPC系列MCU内部Flash IAP驱动入门

    大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家介绍的是恩智浦经典LPC系列MCU内部Flash IAP驱动. LPC 系列 MCU 是恩智浦公司于 2003 年开始推出的非常具有代表性的产品 ...

  10. 看我如何用定值 Cookie 实现反爬

    摘要:本次案例,用定值Cookie实现反爬. 本文分享自华为云社区<我是怎么用一个特殊Cookie,限制住别人的爬虫的>,作者: 梦想橡皮擦 . Cookie 生成 由于本案例需要用到一个 ...