在名称范围内找不到<name>名称.System.Windows.Controls.ControlTemplate&#39;

时间:2016-01-22 20:02:34

标签: c# wpf tabcontrol controltemplate wpf-animation

就在昨天非常相似的情况下,这段代码正在使用完全相同的机器。今天它抛出一个例外..

  

&#34;&#39; SelectedContentBorder&#39;在System.Windows.Controls.ControlTemplate&#39;的名称范围内找不到名称。&#34;

就是这样:

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

那有什么不对?

0 个答案:

没有答案