Установка Storyboard.TargetName
здесь не работает. Бросает 'targetButton' name cannot be found in the name scope of 'System.Windows.Controls.ControlTemplate'
.
Есть ли другой способ сделать это?
<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>