|
2 | 2 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
3 | 3 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
4 | 4 | xmlns:controls="clr-namespace:WPFDevelopers.Controls" |
5 | | - xmlns:helpers="clr-namespace:WPFDevelopers.Helpers"> |
| 5 | + xmlns:helpers="clr-namespace:WPFDevelopers.Helpers" |
| 6 | + xmlns:resx="clr-namespace:WPFDevelopers"> |
6 | 7 | <ResourceDictionary.MergedDictionaries> |
7 | 8 | <ResourceDictionary Source="../Themes/Basic/ControlBasic.xaml" /> |
8 | 9 | <ResourceDictionary Source="../Themes/Basic/Animations.xaml" /> |
|
19 | 20 | <Setter Property="Template"> |
20 | 21 | <Setter.Value> |
21 | 22 | <ControlTemplate TargetType="{x:Type TabItem}"> |
22 | | - <controls:SmallPanel Background="{TemplateBinding Background}"> |
| 23 | + <controls:SmallPanel |
| 24 | + Width="{TemplateBinding Width}" |
| 25 | + Height="{TemplateBinding Height}" |
| 26 | + Background="{TemplateBinding Background}"> |
23 | 27 | <Border x:Name="PART_Border" BorderThickness="{TemplateBinding BorderThickness}" /> |
24 | | - <ContentPresenter |
25 | | - x:Name="PART_ContentPresenter" |
26 | | - Margin="{TemplateBinding Padding}" |
27 | | - HorizontalAlignment="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" |
28 | | - VerticalAlignment="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" |
29 | | - ContentSource="Header" |
30 | | - SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> |
| 28 | + <Grid> |
| 29 | + <Grid.ColumnDefinitions> |
| 30 | + <ColumnDefinition /> |
| 31 | + <ColumnDefinition Width="Auto" /> |
| 32 | + </Grid.ColumnDefinitions> |
| 33 | + <ContentPresenter |
| 34 | + x:Name="PART_ContentPresenter" |
| 35 | + Margin="{TemplateBinding Padding}" |
| 36 | + HorizontalAlignment="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" |
| 37 | + VerticalAlignment="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" |
| 38 | + ContentSource="Header" |
| 39 | + SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> |
| 40 | + <Button |
| 41 | + x:Name="PART_CloseButton" |
| 42 | + Grid.Column="1" |
| 43 | + Width="20" |
| 44 | + Height="20" |
| 45 | + Margin="0,0,4,0" |
| 46 | + helpers:ElementHelper.CornerRadius="4" |
| 47 | + helpers:ElementHelper.IsClear="{Binding Path=(helpers:ElementHelper.IsClear), RelativeSource={RelativeSource TemplatedParent}}" |
| 48 | + Style="{StaticResource WD.NormalButton}" |
| 49 | + ToolTip="{Binding [Close], Source={x:Static resx:LanguageManager.Instance}}" |
| 50 | + Visibility="Collapsed"> |
| 51 | + <controls:PathIcon |
| 52 | + Width="10" |
| 53 | + Height="10" |
| 54 | + Foreground="{DynamicResource WD.SecondaryTextSolidColorBrush}" |
| 55 | + Kind="WindowClose" /> |
| 56 | + </Button> |
| 57 | + </Grid> |
| 58 | + <!--<Line |
| 59 | + x:Name="PART_Line" |
| 60 | + Margin="{TemplateBinding Margin}" |
| 61 | + HorizontalAlignment="Left" |
| 62 | + VerticalAlignment="Center" |
| 63 | + Stroke="{DynamicResource WD.SecondaryTextSolidColorBrush}" |
| 64 | + StrokeThickness="1" |
| 65 | + X1="2" |
| 66 | + X2="2" |
| 67 | + Y1="0" |
| 68 | + Y2="15" />--> |
31 | 69 | </controls:SmallPanel> |
32 | 70 | <ControlTemplate.Triggers> |
33 | 71 | <Trigger Property="IsSelected" Value="True"> |
|
38 | 76 | <Trigger Property="IsMouseOver" Value="True"> |
39 | 77 | <Setter TargetName="PART_ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource WD.PrimaryNormalSolidColorBrush}" /> |
40 | 78 | </Trigger> |
| 79 | + <Trigger Property="helpers:ElementHelper.IsClear" Value="True"> |
| 80 | + <Setter TargetName="PART_CloseButton" Property="Visibility" Value="Visible" /> |
| 81 | + </Trigger> |
| 82 | + <!--<Trigger Property="TabStripPlacement" Value="Left"> |
| 83 | + <Setter TargetName="PART_Line" Property="X1" Value="0" /> |
| 84 | + <Setter TargetName="PART_Line" Property="X2" Value="15" /> |
| 85 | + <Setter TargetName="PART_Line" Property="Y1" Value="2" /> |
| 86 | + <Setter TargetName="PART_Line" Property="Y2" Value="2" /> |
| 87 | + <Setter TargetName="PART_Line" Property="VerticalAlignment" Value="Bottom" /> |
| 88 | + <Setter TargetName="PART_Line" Property="HorizontalAlignment" Value="Center" /> |
| 89 | + </Trigger> |
| 90 | + <Trigger Property="TabStripPlacement" Value="Right"> |
| 91 | + <Setter TargetName="PART_Line" Property="X1" Value="0" /> |
| 92 | + <Setter TargetName="PART_Line" Property="X2" Value="15" /> |
| 93 | + <Setter TargetName="PART_Line" Property="Y1" Value="2" /> |
| 94 | + <Setter TargetName="PART_Line" Property="Y2" Value="2" /> |
| 95 | + <Setter TargetName="PART_Line" Property="VerticalAlignment" Value="Bottom" /> |
| 96 | + <Setter TargetName="PART_Line" Property="HorizontalAlignment" Value="Center" /> |
| 97 | + </Trigger> |
| 98 | + <Trigger Property="IsSelected" Value="True"> |
| 99 | + <Setter TargetName="PART_Line" Property="Visibility" Value="Collapsed" /> |
| 100 | + </Trigger>--> |
41 | 101 | </ControlTemplate.Triggers> |
42 | 102 | </ControlTemplate> |
43 | 103 | </Setter.Value> |
|
85 | 145 | <ControlTemplate TargetType="{x:Type TabControl}"> |
86 | 146 | <controls:WDBorder |
87 | 147 | x:Name="PART_Border" |
| 148 | + Width="{TemplateBinding Width}" |
| 149 | + Height="{TemplateBinding Height}" |
88 | 150 | Margin="{TemplateBinding Margin}" |
89 | 151 | Background="{TemplateBinding Background}" |
90 | 152 | BorderBrush="{TemplateBinding BorderBrush}" |
|
0 commit comments