問下這段xaml代碼的意思....

tx183584 2011-04-27 09:21:07
 <OuterGlowBitmapEffect Opacity="0.7" GlowSize="5" GlowColor="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" />

RelativeSource TemplatedParent網上解釋說 在 ControlTemplate 出现,指定数据源为引用了该 ControlTemplate 的 Control
有沒有更通俗的說法?
(Button.Background).(SolidColorBrush.Color)顏色之間的點號是什麼意思
...全文
62 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
沝林 2011-04-28
  • 打赏
  • 举报
回复
TemplatedParent只有在ControlTemplate 中才有效,RelativeSource TemplatedParent就是将ControlTemplate 所属的控件作为数据源;Path指定数据源的属性作为绑定对象。
(Button.Background)就是Button的Background属性,
.(SolidColorBrush.Color) 其中Background是SolidColorBrush类型,如果背景是渐变刷子,则可以这么写(Button.Background).(GradientBrush.GradientStops)[0].(GradientStop.Color)
jv9 2011-04-28
  • 打赏
  • 举报
回复
这段代码意思是定义一个颜色效果,而该颜色效果是绑定的RelativeSource父模板资源,绑定Button背景色。其中.(SolidColorBrush.Color)是按钮背景色属性,该颜色类型为Color。

8,734

社区成员

发帖
与我相关
我的任务
社区描述
WPF/Silverlight相关讨论
社区管理员
  • WPF/Silverlight社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧