<UserControl>
   <UserControl.Resources>
      <ResourceDictionary>
         <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="TextBlocks.xaml"/>
         </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
   </UserControl.Resources>	  
	<TabItem>
		<TabItem.Header>
		   <TextBlock Style="{StaticResource TabItemHeaderStyle}" Text="xxx" ToolTip="xxx"/>
		</TabItem.Header>
	</TabItem>
</UserControl>


in TextBlocks.xaml, customize header style for selection behaviour.

<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

   <Style x:Key="TabItemHeaderStyle" TargetType="{x:Type TextBlock}">
      <Style.Triggers>
         <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TabItem}}}" Value="True">
            <Setter Property="Foreground" Value="#1fa5d8"/>
            <Setter Property="FontWeight" Value="Bold"/>
         </DataTrigger>
         <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type TabItem}}}" Value="False">
            <Setter Property="Foreground" Value="#4c4c4c"/>
            <Setter Property="FontWeight" Value="Normal"/>
         </DataTrigger>
      </Style.Triggers>
   </Style>
</ResourceDictionary>





posted on 2014-05-06 15:28  chuwachen  阅读(158)  评论(0)    收藏  举报