Wpf 在ControlTemplate上触发的情节提要如何针对ControlTemplate的生成子级?
在这里设置Wpf 在ControlTemplate上触发的情节提要如何针对ControlTemplate的生成子级?,wpf,styles,storyboard,Wpf,Styles,Storyboard,在这里设置情节提要.TargetName不起作用。在“System.Windows.Controls.ControlTemplate”的名称范围中找不到“targetButton”名称 有没有其他方法可以做到这一点 <ControlTemplate x:Key="aTemplate" TargetType="someType"> <ControlTemplate.Triggers> <EventTrigger
情节提要.TargetName
不起作用。在“System.Windows.Controls.ControlTemplate”的名称范围中找不到“targetButton”名称
有没有其他方法可以做到这一点
<ControlTemplate x:Key="aTemplate"
TargetType="someType">
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="Mouse.MouseEnter">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="targetButton ???"
Storyboard.TargetProperty="Opacity"
From="0" To="1" Duration="0:0:0.5" />
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</ControlTemplate.Triggers>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel>
<Label Content="..." />
<Button Opacity="0"
x:Name="targetButton" />
</StackPanel>
<ContentPresenter Grid.Row="1" />
</Grid>
</ControlTemplate>