2

就在昨天,在非常相似的情况下,这段代码在完全相同的机器上工作。今天它抛出了一个异常。

“在‘​​System.Windows.Controls.ControlTemplate’的名称范围内找不到‘SelectedContentBorder’名称。”

就这个:

<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>

那有什么问题?

4

0 回答 0