【发布时间】:2009-11-25 16:03:06
【问题描述】:
这就是我所拥有的
- 我的 window.resource 中一个按钮的 ControlTemplate,有一个带有外发光的椭圆(名为 -- TasksToggleButtonOuterGlowBitmapEffect)和一个文本
- 使用此模板的按钮
这就是我需要的
1.在上述椭圆的外发光上运行的情节提要 2. 我会随时从我的代码隐藏文件中触发这个故事板
当我使用以下 sn-p 尝试此操作时,框架给了我一个运行时异常,指出它无法找到控件,TasksToggleButtonOuterGlowBitmapEffect
<Window.Resource>
<ControlTemplate x:Key="DefaultTasksToggleButtonTemplate" TargetType="ToggleButton">
<Grid Margin="2">
<Border BorderBrush="White" BorderThickness="2" CornerRadius="20">
<Border.BitmapEffect>
<OuterGlowBitmapEffect x:Name="TasksToggleButtonOuterGlowBitmapEffect" GlowColor="LightGray" />
</Border.BitmapEffect>
</Border>
<Ellipse Fill="Red" Width="20" Height="20" Margin="2" />
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Grid>
</ControlTemplate>
<Storyboard x:Key="GlowStoryboard">
<DoubleAnimation Storyboard.TargetName="TasksToggleButtonOuterGlowBitmapEffect" Storyboard.TargetProperty="GlowSize" From="5" To="10" />
</Storyboard>
</Window.Resources>
更新 -- 我希望它出现在资源中,以便任何按钮都可以使用它
【问题讨论】:
标签: c# wpf animation storyboard