2012-10-30 11 views
9

私はMahApps.Metroを学び始めました。私はドキュメントを読んで問題がありました。 AnimatedTabControlを追加するにはMahApps.MetroにAnimatedTabControlを追加するには?

私はResourceDictionariesを含めました:

その後
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 
     <ResourceDictionary.MergedDictionaries> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Purple.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" /> 
     </ResourceDictionary.MergedDictionaries> 
    </ResourceDictionary> 

私は窓の開発を開始しました:

<Controls:MetroWindow x:Class="MyProject.MainWindow" 
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
     xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro" 
     xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 
     xmlns:behaviours="clr-namespace:MahApps.Metro.Behaviours;assembly=MahApps.Metro" 
     Title="MyProject" ShowIconOnTitleBar="True" SaveWindowPosition="True" Height="350" Width="525"> 
    <Window.Resources> 
     <ResourceDictionary Source="Styles\MetroStyles.xaml" /> 
    </Window.Resources> 

    <Controls:MetroWindow.WindowCommands> 
     <Controls:WindowCommands> 
      <Button Content="about" /> 
      <Button Content="settings" /> 
     </Controls:WindowCommands> 
    </Controls:MetroWindow.WindowCommands> 

    <Grid> 
     <Controls:TransitioningContentControl x:Name="Transitioning" Transition="RightReplaceTransition"> 

     </Controls:TransitioningContentControl> 
    </Grid> 
</Controls:MetroWindow> 

Metroウィンドウが正常に動作しますが、私はAnimatedTabControlを追加する方法が分からない...それはですControls:名前空間には含まれません。その後、
Tabs

答えて

16

あなたがの.xamlの上部に

<ResourceDictionary.MergedDictionaries> 

要素に

<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" /> 

を追加するには、TabControlのだろう:私はそのような何かをしたい

アニメーション化してください(まだTabControlタグを使用しますが、Controls.AnimatedTabControlスタイルを使用します)。ここで 全体ResourceDictionaryのタグ

<ResourceDictionary> 
     <ResourceDictionary.MergedDictionaries> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" /> 
      <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedTabControl.xaml" /> 
     </ResourceDictionary.MergedDictionaries> 
    </ResourceDictionary> 
</Window.Resources> 
+2

ああの一例ですので、私は新しいタブコントロールを作成する必要があります: '<のTabItemのコンテンツ= "アイテム1"/><のTabItemコンテンツ= "アイテム2"/> '?私は今夜​​仕事をしているので、今晩チェックアウトします:) – Nickon

+1

はい、あなたのタブコントロールは自動的にanimatedtabcontrolにリソースを追加する限りアニメーションされます –

関連する問題