DeviceFamily XAML Views(一)
DeviceFamily Veiws 可以为特定的设备(Mobile、Desktop等)制作特定的XAML视图,这种方式可以完全定制XMAL和共享后台代码。
以 Mobile 和 Desktop 为例:
- 新建两个文件夹 DeviceFamily-Miobile 和 DeviceFamily-Desktop ;

- 然后在两个文件夹中都添加一个 MainPage.xaml ;

- 如果在 Mobile 设备上运行应用程序,它将从DeviceFamily-Mobile/MainPage.xaml 加载 XMAL; 如果在 Desktop 设备上运行应用程序,它将从DeviceFamily-Desktop/MainPage.xaml 加载 XMAL; 对于其他设备将加载主文件夹下的 MainPage.xaml;
- Example
- DeviceFamily-Mobile/MainPage.xaml
Page
x:Class="_DeviceFamily.DeviceFamily_Mobile.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:_DeviceFamily.DeviceFamily_Mobile"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="Blue">
<TextBlock Text="Hello DeviceFamily-Mobile" VerticalAlignment="Center" FontSize="24" />
</Grid>
</Page>
- Mobile 上的运行效果

- DeviceFamily-Desktop/MainPage.xaml
<Page
x:Class="_DeviceFamily.DeviceFamily_Desktop.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:_DeviceFamily.DeviceFamily_Desktop"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="Red">
<TextBlock VerticalAlignment="Center" Text="Hello DeviceFamily-Desktop" FontSize="56" />
</Grid>
</Page>
- Desktop 上的运行效果

- 主文件下的 MainPage.xaml
<Page
x:Class="_DeviceFamily.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:_DeviceFamily"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="Yellow">
<TextBlock VerticalAlignment="Center" Text="Hello DeviceFamily-Desktop" FontSize="48" />
</Grid>
</Page>
- 运行效果(由于没有 Table 之类的第三种设备,所以此运行效果省略 gg)
DeviceFamily XAML Views(一)的更多相关文章
- Three ways to set specific DeviceFamily XAML Views in UWP
Three ways to set specific DeviceFamily XAML Views in UWP http://igrali.com/2015/08/02/three-ways-to ...
- Windows10-UWP中设备序列显示不同XAML的三种方式[3]
阅读目录: 概述 DeviceFamily-Type文件夹 DeviceFamily-Type扩展 InitializeComponent重载 结论 概述 Windows10-UWP(Universa ...
- Xamarin.Android和UWP之MVVM的简单使用(二)
0x01 前言 前面一篇,Xamarin.Android和UWP之MVVM的简单使用(一),主要讲了MvvmLight的简单使用 这篇主要讲讲MvvmCross的简单使用,例子的话,还是和上篇的一样. ...
- WPF中如何调整TabControl的大小,使其跟随Window的大小而改变?
多年不写技术博客,手生的很,也不知道大家都关注什么,最近在研究Wpf及3d模型的展示,碰到很多问题,这个是最后一个问题,写出来小结一下...... WPF中如何调整TabControl的大小,使其跟随 ...
- 用户控件UserControl图片资源定位(一)---Xaml引用图片
MEF编程实现巧妙灵活松耦合组件化编程,一些细节需要花费不小心思去处理: 其中组件中若包含用户控件,且需要访问图片资源,那么Xaml引用资源需要做以下设置 1. 用户控件(usercontrol)所在 ...
- UAP如何根据DeviceFamily显示不同的页面
背景 微软推出UAP 推荐使用响应式的UI,但是难免遇到一些特殊情况需要使用不同的Page来在不同的设备显示. 微软目前最新的VS2015在10074上安装后能够支持这个功能特性,只是暂时没有文档介绍 ...
- silverlight visifire控件图表制作——silverlight 静态页面xaml
一.silverlight 静态页面 1. 时间控件:DatePicker ,添加引用: xmlns:sdk="clr-namespace:System.Windows.Controls;a ...
- 三种方式设置特定设备UWP XAML view
开发者可以设置UWP特定设备xaml view,在桌面,手机,Iot,这个对于设置对不同设备的不同屏幕有用.我们可以使用RelativePanel,VisualStateTriggers,但是这样我们 ...
- Introducing XAML Standard and .NET Standard 2.0
XAML Standard We are pleased to announce XAML Standard, which is a standards-based effort to unify X ...
随机推荐
- 腾讯开放平台 IOS应用URL schema、Boundle ID填写 (含微博、微信)
解释如下: qq比较麻烦点,需要两个 URL schemes 1.QQ+appID(appid原本是10进制的,需要转换16进制,网址:http://tool.oschina.net/hexconve ...
- php数组高级小结(一)
<?php /** * php5.4新增数组定义 */ $items1 = [ 'a','b','c' ]; $items2=[ 'name'=>'andy','age'=>52 ] ...
- 3.10.17 procfs示例
/* * wesley * the linux module sample of procfs * * wesley for testing * 2013-12-23 ...
- yum简单安装apache
yum install httpd -y chkconfig httpd on service httpd start 启动软件
- HowTo: Linux Server Change OR Setup The Timezone
Method 1 #tzselect # select timezone e.g. Asia/Shanghai#echo 'Asia/Shanghai' > /etc/timezone # se ...
- [转]How to add new table in NopCommerce
本文转自:http://www.tech-coder.com/2015/07/how-to-add-new-table-in-nopcommerce.html Hey guys I am back a ...
- plain framework 1 版本更新 1.0.2 增加打包插件
由于个别因素,该框架的文档没有及时的更新到博客上,但是离线的文档已经完成.本次更新对框架来说显得比较重要,因为在文档的编写过程中经过再次的阅读代码修复了不少错误,最主要的是统一了整个框架的标准风格.对 ...
- z-index学习知识小结
一.z-index七阶层叠顺序表 1.层叠顺序的大小比较: background/border < 负z-index < block块状水平盒子 < float浮动盒子 < i ...
- KSFramework常见问题:Lua脚本热重载,内存状态数据丢失?
Lua热重载 内存数据在重载后会丢失 KSFramework中,所有的UI Lua脚本是可以重载的.脚本中的一些内存数据,在重载后会丢失,比如: -- 记录一个UI界面被打开了多少次 function ...
- Google Play笔记之上架
我最近负责Google Play上架的主要工作 ,现已进入开放测试阶段(随后就可全球首发~~).接入工作已完成,这篇记录一下上架后期的笔记. 开放测试 开放测试是指对所有玩家进行开放式测试,玩家可以通 ...