windows phone 8 xaml 在单击时设置按钮的颜色 [英] windows phone 8 xaml set the color of a button on click

查看:28
本文介绍了windows phone 8 xaml 在单击时设置按钮的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做 win8 手机项目每当我单击按钮时,按钮背景都会更改为手机强调色或文本框上的边框颜色更改为手机强调色或键盘按钮的颜色手机强调色的变化......我试图覆盖 application.resources < 中的 PhoneAccentBrushsolidColorBrush x:Key="PhoneAccentBrush" color="white"/> 但它没有用有什么方法可以为我的应用程序中的所有元素更改电话口音颜色吗??

I am working on win8 phone project whenever I click a button the buttons background changes to phones accent color or on a textBox the border color changes to phones accent color or the color of the keyboard buttons changes to phones accent color ... I tried to overwrite the PhoneAccentBrush in application.resources < solidColorBrush x:Key="PhoneAccentBrush" color="white" /> but it didnt work is there any way to change Phone Accent Color for all elements in my app ??

推荐答案

您可以更改应用中所有 Button 控件的默认样式,使其不使用 {StaticResource PhoneAccentBrush}按下状态.

You can change the default style of all Button controls in your app such that it doesn't use {StaticResource PhoneAccentBrush} in the Pressed state.

打开 Blend 并创建一个简单的 WP8 项目,在其中放置一个 Button,然后抓取模板的副本(右键单击按钮并编辑副本).有关步骤,请参阅 Jeff Wilcox 的博客过程的分步说明.

Open Blend and create a simple WP8 project, put a Button in it and then grab a copy of the template (right click on the button and Edit a copy). See Jeff Wilcox's blog for a step-by-step description of the process.

然后您可以将模板粘贴到您的 App.xaml 中.如果您删除 x:Key,它将成为该控件的默认样式.

Then you can paste the template into your App.xaml. If you remove the x:Keyit becomes the default style for that control.

或者,您可以查看有关在任何地方覆盖主题的 StackOverflow 问题.

这篇关于windows phone 8 xaml 在单击时设置按钮的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆