C# 如何让故事板在日历控件模板中使用边框
我已编辑日历控件的CalendarItem模板。我已将自己的边框添加到此模板 我正在使用CalendarItemStyle实现日历 我通常有这样一个故事板C# 如何让故事板在日历控件模板中使用边框,c#,wpf,vb.net,xaml,C#,Wpf,Vb.net,Xaml,我已编辑日历控件的CalendarItem模板。我已将自己的边框添加到此模板 我正在使用CalendarItemStyle实现日历 我通常有这样一个故事板 <Storyboard x:Key="sbBorderHighlighted"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="border">
<Storyboard x:Key="sbBorderHighlighted">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="border">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<EventTrigger RoutedEvent="Mouse.MouseEnter">
<BeginStoryboard x:Name="sbBorderHighlighted_BeginStoryboard" Storyboard="{StaticResource sbBorderHighlighted}"/>
</EventTrigger>
我这样称呼它
<Storyboard x:Key="sbBorderHighlighted">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="border">
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
<EventTrigger RoutedEvent="Mouse.MouseEnter">
<BeginStoryboard x:Name="sbBorderHighlighted_BeginStoryboard" Storyboard="{StaticResource sbBorderHighlighted}"/>
</EventTrigger>
因此,如果在日历控件上使用此事件触发器,我如何更改情节提要,使其以模板中的边框为目标?尝试使用类似于此情节提要的{x:Reference}。Target={x:Reference border}而不是使用StoryBoard.TargetName,因为这有一些与范围相关的问题。感谢您的回复。不幸的是,这在InitializeComponent处给了我一个未解决的引用错误。因此,{x:Reference}似乎没有深入挖掘模板。