在开发wp的时候,难免要设置好多属性。但是有好多属性是重复的,我们可不可统一 设置样式呢,答案是肯定的

代码如下

<Page
x:Class="Blue.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Blue"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Background>
<SolidColorBrush Color="#FFFAF8EF"/>
</Page.Background> <Page.Resources>
<Style TargetType="TextBlock" x:Key="HistoryText">
<Setter Property="FontSize" Value="18"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Center"/>
</Style>
<Style TargetType="Button" x:Key="ButtonText">
<Setter Property="Foreground" Value="Black"/>
</Style>
</Page.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2*"/>
<RowDefinition Height="5*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<!--游戏标题-->
<StackPanel>
<TextBlock Foreground="Black" FontSize="60">蓝色拼图</TextBlock>
<StackPanel Orientation="Horizontal">
<Button Margin="10,0" Style="{StaticResource ButtonText}">重新开始</Button> <Button Style="{StaticResource ButtonText}">说明</Button>
</StackPanel>
</StackPanel> <!--历史面板-->
<Grid Grid.Column="1" Margin="10">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/> </Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Grid.Row="0" Style="{StaticResource HistoryText}" ></TextBlock>
<TextBlock Grid.Column="1" Grid.Row="0" Style="{StaticResource HistoryText}" >当前</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="0" Style="{StaticResource HistoryText}" >历史</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="1" Style="{StaticResource HistoryText}" >级别</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1" Style="{StaticResource HistoryText}" >6</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="1" Style="{StaticResource HistoryText}" >6</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="2" Style="{StaticResource HistoryText}" >点击</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="2" Style="{StaticResource HistoryText}" >22</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="2" Style="{StaticResource HistoryText}" >22</TextBlock>
</Grid> </Grid> </Page>

(wp8.1)样式资源的更多相关文章

  1. WPF样式资源文件简单运用

    WPF通过资源来保存一些可以被重复利用的样式,下面的示例展示了简单的资源样式文件的使用: 一.xaml中定义资源及简单的引用 <Window.Resources > <!--wpf窗 ...

  2. 样式(Style)和主题(Theme)资源——样式资源

    样式和主题资源都是用于对Android应用进行“美化”的,只要充分利用Android应用的样式和主题资源,开发者可以开发出各种风格的Android应用. 样式资源:         如果我们经常需要对 ...

  3. Android开发:UI相关(一)自定义样式资源

    一.自定义样式资源:   1.在drawble中新建xml资源文件:     如果新建的xml文件没有自动放置在drawable文件夹下,就手动移动到drawable下. 2.编写样式代码: < ...

  4. Android学习笔记样式资源文件

    样式资源和主题资源都是写在styles.xml文件里面的 <style name="title"> <item name="android:textSi ...

  5. webpack 打包样式资源

    webpack 打包样式资源 webpack.config.js配置文件内容为: // 用来拼接绝对路径的方法 const {resolve} = require('path') module.exp ...

  6. Webpack干货系列 | 怎么运用 Webpack 5 处理css/scss/sass、less、stylus样式资源

    程序员优雅哥简介:十年程序员,呆过央企外企私企,做过前端后端架构.分享vue.Java等前后端技术和架构. 本文摘要:主要讲解webpack 5 如何高效处理CSS 资源.scss/sass 资源.l ...

  7. WPF自定义圆形按钮样式资源文件

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x ...

  8. WPF样式和资源2

    <Window.Resources> <FontFamily x:key="ButtonFontFamily">Time New Roman</Fon ...

  9. 《Programming WPF》翻译 第6章 2.资源与样式

    原文:<Programming WPF>翻译 第6章 2.资源与样式 WPF的样式机制以来于资源体系来定位样式.正如你在第5章看到的,样式在元素的资源片段中定义,而且样式通过其名字被引用, ...

随机推荐

  1. 【Python】python2.7 安装配置OpenCV2

    环境:Ubuntu16.04 anaconda Python2.7 opencv2.4.13 安装opencv后 import cv2 遇到错误信息: No module named cv2 安装op ...

  2. BZOJ3648:寝室管理

    浅谈树分治:https://www.cnblogs.com/AKMer/p/10014803.html 题目传送门:https://www.lydsy.com/JudgeOnline/problem. ...

  3. 对于makefile传递参数的一些问题

    makefile变量说明: 1.总控Makefile中使用“-e”参数覆盖下一层Makefile中的变量. 2.父级Makefile向子级Makefile传送变量方式:export <varia ...

  4. 五 Vue学习 首页学习 (上)

    首页:   http://localhost:8002/#/,  登录页面如下: index.js文件中如下的路由配置,转过去看login.vue是如何实现的. const routes = [ { ...

  5. 五 akka streams kafka

    (转载 https://doc.akka.io/docs/akka-stream-kafka/current/home.html) 一: Akka Streams Kafka, also known ...

  6. bzoj4176

    莫比乌斯反演 根据约数和个数公式 $ans = \sum_{i=1}^{n}\sum_{j=1}^{n}\sum_{x|i}\sum_{y|j}{[gcd(i, j)==1]}$ 交换枚举顺序 $an ...

  7. SQL 排序规则问题

    http://blog.csdn.net/delphigbg/article/details/12744807 MSSQL排序规则总结   什么是排序规则呢? 排序规则根据特定语言和区域设置标准指定对 ...

  8. oracle 内连接 外连接 查询 笔记

    elect ename,job,sal from emp where deptno>10 order by sal desc; 联合查询,PK dept.deptno FK emp.deptno ...

  9. Oracle&nbsp;11g&nbsp;R2安装手册(…

    1.Oracle 11g R2安装手册(图文教程)For Windows 1.下载Oracle 11g R2 for Windows版本,下载地址如下官方网站:http://download.orac ...

  10. centos6.5安装gtk开发环境

    0.说明 由于 centos 默认的桌面是 gnome 的,我们知道gnome 的依赖库就是 gtk,而 gtk 各个版本的差异性还是很大的,所以我们需要根据 centos 的不同版本选择和 cent ...