2015-05-29 66 views
1

我使用MahApps AnimatedTabControl,我需要創建一個的ControlTemplate添加一個ScrollViewer中的標題標籤。這是我的模板:添加控件模板來AnimatedTabControl而不覆蓋動畫行爲

 <TabControl.Template> 
      <ControlTemplate TargetType="{x:Type TabControl}"> 
       <Grid> 
        <Grid.RowDefinitions> 
         <RowDefinition Height="Auto"/> 
         <RowDefinition/> 
        </Grid.RowDefinitions> 
        <ScrollViewer x:Name="_MainTabControlScrollViewer" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled"> 
         <TabPanel x:Name="HeaderPanel" IsItemsHost="True" Margin="0,4,0,0"/> 
        </ScrollViewer> 
        <ContentPresenter x:Name="PART_SelectedContentHost" Margin="4" ContentSource="SelectedContent" Grid.Row="1"/> 
       </Grid> 
      </ControlTemplate> 
     </TabControl.Template> 

但是,這會殺死動畫。有沒有辦法繼承默認的AnimatedTabControl行爲?

回答

0

重寫TabControl只需使用MetroAnimatedSingleRowTabControl即可。

<Controls:MetroAnimatedSingleRowTabControl x:Name="AnimatedTabControl"> 
    <TabItem Header="tab test"></TabItem> 
</Controls:MetroAnimatedSingleRowTabControl> 

xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"

希望有所幫助。

+0

不幸的是,沒有幫助。我懷疑這是因爲有另一個ControlTemplate將我的Grid包裝在 eYe