应用颜色资源时如何在颜色上处理标签鼠标 [英] How to handle label mouse over colours when colour resource is applied

查看:60
本文介绍了应用颜色资源时如何在颜色上处理标签鼠标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以创建一个电影,在MouseEnter事件中,我可以将标签的静态颜色从一种颜色更改为另一种颜色(例如,黑色到白色)。 这很有效。

I can create a movie where on the MouseEnter event, I can change the static colour of a label from one colour to another (black to white, for example).  This works well.

现在通过扩展,我想让这两种颜色由所采用的主题控制,程序范围。 因此,我尝试将标签颜色分配给资源字典中名为labelNormal的资源颜色定义。 然后,在电影的
中,我试图将其更改为labelOver,这是我资源字典中的另一种颜色。 不幸的是,它不起作用 - 无论电影如何,它都会将labelOver永久地分配给标签颜色。 如果我指定静态颜色,
,但是一旦我将前景颜色设置为资源,它就无效。

Now by extension, I want to make those two colours controlled by the theme employed, program wide.  As a result, I have attempted to assign the label colour to a resource colour definition called labelNormal in my resource dictionary.  Then, in the movie, I have attempted to change this to labelOver, another colour in my resource dictionary.  Unfortunately, it doesn't work--it permanently assigns labelOver to the label colour regardless of the movie.  It works well if I assign colours static, but does not work once I make the foreground colour a resource instead.

处理颜色变化的好方法是什么由主题处理? 感谢任何帮助。

What's a good way to handle colour changes like this that is handled by the theme?  Any help is appreciated.

推荐答案

你能发布你正在使用的xaml代码吗?
Could you post the xaml code you are using?


这篇关于应用颜色资源时如何在颜色上处理标签鼠标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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