就在昨天非常相似的情况下,这段代码正在使用完全相同的机器。今天它抛出一个例外..
"' SelectedContentBorder'在System.Windows.Controls.ControlTemplate'的名称范围内找不到名称。"
就是这样:
<ControlTemplate TargetType="{x:Type TabControl}">
<Border Name="SelectedContentBorder">
<ContentPresenter Name="ContentPresenter" ContentSource="SelectedContent" />
</Border>
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="SelectionChanged">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
From="0"
To="1"
Duration="00:00:0.5"
Storyboard.TargetName="SelectedContentBorder"
Storyboard.TargetProperty="Opacity"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
那有什么不对?