我不明白这个来自Microsoft的按钮模板示例是如何工作的...在其各种状态的故事板中,它为目标类型的Border设置Panel.Background(下面的示例).我没有看到Border以任何方式继承Panel.
将TargetProperty设置为Border.Background ...似乎以相同的方式工作.我只想了解发生了什么的细微差别...每次我认为我有一个WPF的处理,我遇到了一些我无法解释的东西:(
<ColorAnimationUsingKeyFrames
Storyboard.TargetProperty="(Panel.Background).(GradientBrush.GradientStops)[1].(GradientStop.Color)"
Storyboard.TargetName="Border">
<EasingColorKeyFrame
KeyTime="0"
Value="{StaticResource ControlPressedColor}" />
Run Code Online (Sandbox Code Playgroud)
这是因为依赖属性可以重用,Border只是添加了Panelvia 的属性AddOwner.属性字段初始化如下:
public static readonly DependencyProperty BackgroundProperty =
Panel.BackgroundProperty.AddOwner(typeof(Border), ...
Run Code Online (Sandbox Code Playgroud)
所以该Panel.Background物业与物业相同Border.Background.
| 归档时间: |
|
| 查看次数: |
474 次 |
| 最近记录: |