开发者

Silverlight change color custom control programmatically

开发者 https://www.devze.com 2023-01-03 08:49 出处:网络
I have this Ellipse which I turned into a custom control so I could animate it programmatically. However I am having trouble changing its color.

I have this Ellipse which I turned into a custom control so I could animate it programmatically. However I am having trouble changing its color.

I know about changing a shapes color like this:

aRectangle.Fill = new SolidColorBrush(Colors.Blue)开发者_JAVA百科;

However I cannot do this with a custom control.

Anyone know how?


How you set the color would depend on the template for the control, but in general I believe there is a Foreground brush property on the Control class. You should probably have all of the parts of your template honor this property so the entire control is colored properly.

0

精彩评论

暂无评论...
验证码 换一张
取 消