Silverlight投影阴影颜色绑定 [英] Silverlight Drop Shadow Color binding
本文介绍了Silverlight投影阴影颜色绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用转换器类将颜色绑定到阴影效果。
< dropshadoweffect x:key =DropShadowcolor ={Binding ScoreBrush,Converter = {StaticResource ColorSelector}}blurradius =150shadowdepth =0/>
这就是我所做的,但它是默认的。这种方法适用于其他颜色,例如背景颜色。
有人可以解释一下这是为什么吗?
解决方案
< blockquote>你应该从Converter类返回一个类似这样的颜色对象
public object 转换( object value ,输入targetType, object 参数,System.Globalization.CultureInfo文化)
{
if (值 string )
{
return Colors.Yellow;
}
return Colors.Black;
}
Hi, I am trying to bind a color to a drop shadow effect using a converter class.
< dropshadoweffect x:key="DropShadow" color="{Binding ScoreBrush, Converter={StaticResource ColorSelector}}" blurradius="150" shadowdepth="0" />
that is what I did, But it is leaving it as default. This exact way works on other colors e.g background color.
Could someone please explain why this is?
解决方案
You should return a Color object from the Converter class something like this
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { if (value is string) { return Colors.Yellow; } return Colors.Black; }
这篇关于Silverlight投影阴影颜色绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文