在开发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. 【Lintcode】137.Clone Graph

    题目: Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. ...

  2. Spring boot 2.0 学习

    Spring boot 2.0出来了,支持java 9, 好多新特性,应该学习.   待续... ...

  3. jsonp实现数据跨域请求

    1.我们知道,哪怕跨域js文件中的代码(当然指符合web脚本安全策略的),web页面也是可以无条件执行的. 远程服务器remoteserver.com根目录下有个remote.js文件代码如下: al ...

  4. query builder 在线生成sql

    http://devtools.korzh.com/easyquery/javascript/docs/javascript-query-builder-php

  5. Apache日志解读

    想要知道什么人在什么时候浏览了网站的哪些内容吗?查看Apache的访问日志就可以知道.访问日志是Apache的标准日志,本文详细解释了访问日志的内容以及相关选项的配置. 一.访问日志的格式  Apac ...

  6. [hdu4738]求桥模板

    oj问题,待修改,存档. #include<stdio.h> #include<iostream> #include<cstdio> #include<sta ...

  7. windows7如何打开远程桌面&nbsp;-…

    单位的机器,刚装上了windows7旗舰版(当然不是花银子滴),想打开远程桌面连接,这样从别的机器登录也方便.可是问题来了,windows7对安全的设置比较高,不像windows XP那么随便一点就可 ...

  8. 使用BIND安装智能DNS服务器(一)---基本的主从DNS服务器搭建

    参考网址:http://www.unixmen.com/dns-server-installation-step-by-step-using-centos-6-3/ DNS(Domain Name S ...

  9. Go中函数作为值、类型传递。

    在Go中函数也是一种变量,我们可以通过type来定义它,它的类型就是所有拥有相同的参数,相同的返回值的一种类型 type typeName func(input1 inputType1 , input ...

  10. 【原】spring+springmvc+mybatis整合

    整合框架的代码结构: 最全约束: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=&q ...