在开发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. 「HNOI2008」「LuoguP3197」越狱(数论

    题目描述 原题来自:HNOI 2008 监狱有连续编号为 111 到 nnn 的 nnn 个房间,每个房间关押一个犯人.有 mmm 种宗教,每个犯人可能信仰其中一种.如果相邻房间的犯人信仰的宗教相同, ...

  2. poj 2559 最大矩形面积(单调栈)

    题目:输入一个整数n,代表有n个  1(宽度) * h[i](高度)的矩形.接下来n个数依次给定一个矩形高度的高度h[i](i<=n). 求:在给定的依次排列的这堆矩形构成的图形里用一个矩形圈出 ...

  3. 高性能的序列化与反序列化:kryo的简单使用

    前言:kryo是个高效的java序列化/反序列化库,目前Twitter.yahoo.Apache.strom等等在使用该技术,比如Apache的spark.hive等大数据领域用的较多. 为什么使用k ...

  4. bzoj 4278 Tasowanie —— 后缀数组

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4278 每次取两个后缀中字典序较小的那个的首字符: 注意超出去的部分是 inf 而不是 0,因 ...

  5. Python 查看本机WiFi密码

    http://www.lijiejie.com/python-get-all-saved-wifi-passwords/ 很早以前我写过一个,丢了.  今天偶然看到这篇文章 , 也是很久以前写的,他用 ...

  6. 【247】◀▶IEW-Unit12

    Unit 12 Leisure Activities 1.Model1对应图片分析 2.Model1范文分析 The pie chart shows the six sporting activiti ...

  7. CF-851B

    B. Arpa and an exam about geometry time limit per test 2 seconds memory limit per test 256 megabytes ...

  8. pig ERROR 2997: Encountered IOException. File or directory null does not exist.

    grunt> ls 2014-03-30 19:58:31,344 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 2997: Enc ...

  9. Java负数的位运算

    /** * 求负数的位运算 *///1. -10 >> 2 = ?//2. -10的原码: 1000 0000 0000 0000 0000 0000 0000 1010 最高位代表符号位 ...

  10. nodejs安装使用express

    1.用Express 应用程序生成器 express-generator 快速搭建express框架 1.1安装: npm install express-generator -g 1.2 生成目录: ...