- 浏览: 57029 次
- 性别:
- 来自: 北京
文章分类
- 全部博客 (93)
- java (3)
- ios (9)
- wp (15)
- android (0)
- js (1)
- 服务器 (0)
- db (0)
- linux (1)
- python (0)
- xcode (0)
- ide (2)
- maven (0)
- spring (0)
- sql (0)
- 第三方 (1)
- nexus (0)
- nginx (11)
- tomcat (0)
- jenkins (0)
- zookeeper (1)
- git (1)
- svn (0)
- uml (0)
- redis (4)
- activemq (1)
- flume (0)
- kafka (0)
- mysql (1)
- memcached (0)
- mybatis (0)
- mac (0)
- mongo (1)
- docker (6)
- cache (0)
- jvm (0)
- markdown (0)
- springboot (24)
- mycat (3)
- LTS (3)
- 运维 (0)
- opts (1)
- netty (1)
- tcc (0)
- ffmpeg (2)
- 直播 (6)
- cxf (0)
- nodejs (0)
- storm (0)
- elasticjob (0)
- php (0)
最新评论
自定义一个返回按钮,以下是我的操作。
内容部分也是在网上参考的,但是都不太详细,我详细总结一下:
1.首先右键 .xaml文件 用blend打开
2.打开后 查看源
3.点击一下 源中你要自定义背景的button标签
4.看blend的左侧 在button上右键 编辑模版 编辑副本 确定
这时候会在 <phone:PhoneApplicationPage.Resources></phone:PhoneApplicationPage.Resources>标签内生成style资源
5.你可以在style资源中控制一下 背景色之类的
我的代码如下:
1. xaml中button定义如下
<Button x:Name="backButton"
HorizontalAlignment="Center" VerticalAlignment="Center"
Height="70" Width="70" Style="{StaticResource ButtonStyle1}"
Click="goBack">
<Button.Background>
<ImageBrush Stretch="Fill" ImageSource="/Assets/black_back.png"/>
</Button.Background>
</Button>
2.resource中的style如下
<Style x:Key="ButtonStyle1" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
<Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/>
<Setter Property="Padding" Value="10,5,10,6"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver"/>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneButtonBasePressedForegroundBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="ButtonBackground" BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="5">
<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
这样就会生成一个自定义背景的button background是transparent的
效果如图所示:
资讯左侧的返回 按钮就是我自定义的
内容部分也是在网上参考的,但是都不太详细,我详细总结一下:
1.首先右键 .xaml文件 用blend打开
2.打开后 查看源
3.点击一下 源中你要自定义背景的button标签
4.看blend的左侧 在button上右键 编辑模版 编辑副本 确定
这时候会在 <phone:PhoneApplicationPage.Resources></phone:PhoneApplicationPage.Resources>标签内生成style资源
5.你可以在style资源中控制一下 背景色之类的
我的代码如下:
1. xaml中button定义如下
<Button x:Name="backButton"
HorizontalAlignment="Center" VerticalAlignment="Center"
Height="70" Width="70" Style="{StaticResource ButtonStyle1}"
Click="goBack">
<Button.Background>
<ImageBrush Stretch="Fill" ImageSource="/Assets/black_back.png"/>
</Button.Background>
</Button>
2.resource中的style如下
<Style x:Key="ButtonStyle1" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
<Setter Property="BorderThickness" Value="{StaticResource PhoneBorderThickness}"/>
<Setter Property="FontFamily" Value="{StaticResource PhoneFontFamilySemiBold}"/>
<Setter Property="FontSize" Value="{StaticResource PhoneFontSizeMedium}"/>
<Setter Property="Padding" Value="10,5,10,6"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Background="Transparent">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver"/>
<VisualState x:Name="Pressed">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneButtonBasePressedForegroundBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentContainer">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ButtonBackground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PhoneDisabledBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ButtonBackground">
<DiscreteObjectKeyFrame KeyTime="0" Value="Transparent"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="ButtonBackground" BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="0" Margin="5">
<ContentControl x:Name="ContentContainer" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
这样就会生成一个自定义背景的button background是transparent的
效果如图所示:
资讯左侧的返回 按钮就是我自定义的
发表评论
-
wp win8开发:scrollview滑动动画效果
2017-01-10 17:07 428产品需求,暂别ios开发,着手win8开发。 说说这个scr ... -
wp wp8:指定通信资源(端口)已由另一个应用程序使用 错误
2017-01-10 17:06 380测试机器是820t时,一直正常运行,后来改用920t的时候安装 ... -
wp wp8:自定义控件 自定义progressbar
2017-01-11 13:31 323MProgress.cs using System; usi ... -
wp wp8:服务器推送
2017-01-11 13:32 407前提:必须使用真机,真机注册 服务器端使用的是winform ... -
wp wp8:lbs
2017-01-12 10:51 411上码:不解释 using System; using Sys ... -
wp wp8:计划通知
2017-01-10 17:06 381using System; using System.Coll ... -
wp wp8:后台任务
2017-01-10 17:10 360MScheduledTaskAgent项目下 Schedule ... -
wp wp8:页面转换 page transitions
2017-01-12 10:47 503首先导入Toolkit.dll文件 将App.xaml.cs ... -
wp wp8:公共样式定义
2017-02-07 10:12 457在Resources下创建一个名称为buttonStyle.x ... -
wp wp8:后台传输服务
2017-01-11 13:27 4241.TransferPreferences属性设置: 后台传 ... -
wp wp8:自定义dll库创建
2017-01-11 13:28 467鉴于项目测试: 创建一个wp8项目 在解决方案下 右键 操 ... -
wp wp8:sqlite安装
2017-01-12 10:47 437打开vs 检测一下时候安装了sqlite for window ... -
wp wp8:手势GuestureService/GuestureListener
2017-01-12 10:51 5301.利用Silverlight Tookit中提供的手势服务监 ... -
wp wp8&win8:Stretch的Uniform和UniformToFill
2017-01-12 10:51 568Uniform,控件的高度和宽度会增加直到达到了容器的大小,也 ...
相关推荐
WP7系统的一个基于位置的服务应用程序,可以查看地图,分享位置,并具有社交功能
2022最新版:PEARL WP V3.3.2主题:企业商业WordPress主题.rar
2022最新版:READ WP V4.5.9主题:极简主义WordPress博客主题.rar
WP主题 自定义Angular.js支持的WordPress主题 我开始对学习更多有关Angular.js的兴趣感兴趣,因此我想我应该建立一个自定义主题。 Grunt.js 所有自动化均由Grunt处理。 必要的脚本和样式已合并为一个样式表...
自定义快照 提供用于管理Customizer变更集的UI; 将变更集保存为命名草稿,发布时间表; 在管理员中检查并在前端预览。 贡献者: , , , , , 标签:,,至少需要: 4.7 经测试至: 4.9 稳定标签: 0.7.0 许可...
微软拯救WP7十大方案:收购手机厂商 忘掉苹果.docx
Learn-wp-cli:命令行,WP-CLI和自定义WP-CLI命令入门
WordPress沙盒助手 这是一个自定义的wordpress插件,可帮助标准化我创建的所有wordpress产品演示站点。
公告采用WP3.0自定义发布类型功能,可能大家对这个都不是很熟悉,有此功能的主题也不多。启用主题后,在侧边文章面板下会增加公告面板,点击添加新公告,就可以编写公告,与正常的写日志基本无差别,增加的公告内容...
WP_Route是在WordPress中创建自定义路由以侦听webhooks,oAuth回调和基本路由的一种简单方法。 WP_Route是一个单类解决方案,不需要任何设置,并支持路由参数和重定向。 简介: WP_Route :: get ( 'flights' , '...
智能指针sp和wp在android c++源码中使用非常频繁,例如IBinder机制,但是它比c++中普通的智能指针要复杂很多,相信不少android学习者如果c++基础不是很扎实的,看起来会比较吃力和枯燥。本人在android 4.2.2源码基础...
开始之前选修的如果我们需要对wp容器的bash访问,请在docker-compose.yml中设置...services : ... wordpress : ... container_name : some_unique_container_name ... ssh到wp容器,其中包括: docker exec -it ...
①、进入WP8应用商店网页 ②、点击登录,输入您的手机账号(登录绑定的LIVE邮箱) ③、手机上,点击设置-查找我的手机-勾选:使用推送通知 ④、手机上,点击设置-WLAN-点击打开(注:确保手机可以上网也可以,但...
wpf自定义图片控件,可画框,图片浏览,不喜勿喷!
WP-Metabox 可用于创建和扩展自定义 postmeta 类型、自定义元框和自定义内容类型。 注释掉examples.php包括wp-metabox.php看到你的WordPress网站在行动的例子。 自定义帖子元 # creates a new post meta type ...
功夫不负有心人,笔者终于找的了这样的一款强大的表单插件,它就是cformsII,cforms意思为custom forms,就是自定义表单的意思。 cformsII具有以下功能: •设定自定义表单,允许插入到页面,日志中去; •非常强悍...
自定义 2015 WordPress 基线主题 这是 GoldenComm 2015 的 WordPress 基线主题。该主题使用 Foundation 作为 CSS 和 JavaScript 库的基础 文件夹结构 注意:您必须在终端中运行gulp才能编译、连接和缩小 Sass 和 ...
WP8桌面 LauncherWP8 v2.6.3 版本:2.6.3软件语言:中文软件类别:桌面 软件大小:8.89 MB适用固件:2.0及更高固件 内置广告:没有广告适用平台:Android WP8(LauncherWP8)桌面是一款Windows Phone 8风格的桌面...
R4You测试文档该存储库包含: 自定义wordpress主题文件夹-wp_r4u 关于该主题的文档-自述文件数据库转储-wp_r4u.sql 演示内容导入到Wordpress- wp_r4u.xml主题信息名称: WP R4U 资料夹: wp_r4u 相对路径: / wp-...
默认调用四篇最新文章,缩略图支持WP特色图像、添加自定义栏目、自动获取文章中图片、随机缩略图等,也可以切换到Key模式,分别添加自定义栏目,名称:hot和image,调用指定文章及缩略图,缩略图大小236×155px具体...