WPF编辑资源 [英] WPF Edit Resource

查看:137
本文介绍了WPF编辑资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

喜有没有办法来改变从code,或通过一些有约束力的资源刷?
我想要做的是改变我的主画笔的颜色单击按钮时。

Hi is there any way to change a Resource brush from code or via some binding? what I want to do is change the color of my "main" brush when a button is clicked.

非常感谢!

编辑:

它是一个GradientBrush我如何改变了颜色?

Its a GradientBrush how do i change the colors on that?

myBrush.GradientStops[0].Color = Colors.Red;

只是给了我一个例外......是有什么办法动画颜色变化,就像一个故事板?

just gives me a exception... and is there any way to animate the color change, like a story board?

推荐答案

有关动画的变化,尝试创建一个Storyboard,并呼吁开始就可以了。

For animating the change, try creating a Storyboard and calling Begin on it.

(我会去拼凑一个例子)

(I'll go throw together an example)

编辑:看起来像它的另一个Silverlight的WPF =失败,我的一部分。我似乎无法得到它打算在WPF。

edit: Looks like it's another Silverlight != WPF fail on my part. I cant seem to get it going in WPF.

这篇关于WPF编辑资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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