2011-09-06 13 views

Odpowiedz

14

Oto krótki przykład wykonana z Kaxaml:

<Page 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> 
    <Page.Resources> 
    <Style x:Key="chevronTabItemStyle" TargetType="{x:Type TabItem}"> 
     <Setter Property="Foreground" Value="White" /> 
     <Setter Property="Template"> 
     <Setter.Value> 
      <ControlTemplate TargetType="{x:Type TabItem}"> 
      <StackPanel Orientation="Horizontal" Margin="0,0,-7,0" Height="30"> 
       <Path Data="M0,0 10,0 10,30 0,30 10,15" 
        Fill="{TemplateBinding Background}"/> 
       <Grid> 
       <Rectangle Fill="{TemplateBinding Background}" /> 
       <TextBlock Text="{TemplateBinding Header}" Margin="10,5" VerticalAlignment="Center" /> 
       </Grid> 
       <Path Data="M0,0 10,15 0,30" 
        Fill="{TemplateBinding Background}" />     
      </StackPanel> 
      </ControlTemplate> 
     </Setter.Value> 
     </Setter> 
    </Style> 
    </Page.Resources> 
    <Grid> 
    <TabControl ItemContainerStyle="{StaticResource chevronTabItemStyle}"> 
     <TabItem Header="Design" Background="DarkSlateBlue" /> 
     <TabItem Header="Plan" Background="DarkCyan" /> 
     <TabItem Header="Build" Background="LightSkyBlue" /> 
     <TabItem Header="Test" Background="SandyBrown" /> 
     <TabItem Header="Evaluate" Background="SteelBlue" /> 
    </TabControl> 
    </Grid> 
</Page> 

Prawdopodobnie będzie trzeba ustawić kilka właściwości, ale jest to z grubsza to, co opisane ...

enter image description here

+0

+1, bardzo ładna odpowiedź! –

+0

Wow, bardzo ładne - wygląda idealnie na to, czego szukam .. dzięki za zapewnienie naprawdę solidnej bazy! – Steoates

3

Thomas Levesque Twoja odpowiedź jest piękna!

Jest mały problem z kolorem planie, przenieść własność na TextBlock zapobiec całą kartę, aby być w kolorze Biały

W ten sposób możemy zmienić kolor nagłówka lub jeśli właściwości IsEnable Wybrane są cenione.

<Style x:Key="TestNewTabStyle" TargetType="{x:Type TabItem}"> 
     <Setter Property="Template"> 
      <Setter.Value> 
       <ControlTemplate TargetType="{x:Type TabItem}">       
        <StackPanel Orientation="Horizontal" Margin="0,0,-7,0" Height="30"> 
         <Path Data="M0,0 10,0 10,30 0,30 10,15" Fill="{TemplateBinding Background}"/> 
         <Grid > 
          <Rectangle Fill="{TemplateBinding Background}" /> 
          <TextBlock Name="HeaderArrow" Text="{TemplateBinding Header}" Margin="15,5" VerticalAlignment="Center" Foreground="White"**/> 
         </Grid> 
         <Path Data="M0,0 10,15 0,30" Fill="{TemplateBinding Background}" /> 
        </StackPanel> 
        <ControlTemplate.Triggers> 
         <Trigger Property="IsSelected" Value="True"> 
          <Setter TargetName="HeaderArrow" Property="FontWeight" Value="Bold" /> 
          <Setter TargetName="HeaderArrow" Property="Foreground" Value="Yellow" /> 
         </Trigger> 
         <Trigger Property="IsEnabled" Value="False"> 
          <Setter TargetName="HeaderArrow" Property="Foreground" Value="DarkGray" /> 
         </Trigger> 
        </ControlTemplate.Triggers> 
       </ControlTemplate> 
      </Setter.Value> 
     </Setter> 
    </Style> 
Powiązane problemy