原文转载:http://my.oschina.net/linuxred/blog/93828
近日项目使用TabControl ,希望好看一下,从网上搜到上面那篇博客,仿Office样式,很好看,但原博主代码放的比较抽象,调试了半天,在自己机器上调通之后,Share一份给大家~~~~~~
<Window x:Class="XXX.Dialog.PublishDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="380" Width="600" Icon="/DMS;component/Resources/logo.png" ResizeMode="NoResize" Title="发布项目" Background="White">
<Window.Resources>
<ControlTemplate x:Key="OfficeTabControl" TargetType="{x:Type TabControl}">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup Name="SelectionStates">
<VisualState Name="Selected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="buttonBackgroundShape" Storyboard.TargetProperty="Opacity" To="0" Duration="0"/>
</Storyboard>
</VisualState>
<VisualState Name="Unselected">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="buttonBackgroundShape" Storyboard.TargetProperty="Opacity" To="1" Duration="0"/>
</Storyboard>
</VisualState>
</VisualStateGroup>