Skip to content

Commit e2b8c65

Browse files
committed
Style for Dragablz added
1 parent f9358dd commit e2b8c65

3 files changed

Lines changed: 73 additions & 51 deletions

File tree

‎Source/NETworkManager/MainWindow.xaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@
499499
<RowDefinition Height="*" />
500500
</Grid.RowDefinitions>
501501
<Border x:Name="HeaderBorder" Grid.Row="0" BorderBrush="{DynamicResource GrayBrush8}" BorderThickness="0,0,0,1" MouseDown="HeaderBorder_MouseDown">
502-
<TextBlock VerticalAlignment="Center" Height="48" TextAlignment="Center" Style="{StaticResource HeaderTextBlock}" Text="{Binding SelectedApplicationViewInfo.TranslatedName}" Foreground="{DynamicResource GrayBrush3}" Margin="0" />
502+
<TextBlock VerticalAlignment="Center" Height="48" TextAlignment="Center" Style="{StaticResource HeaderTextBlock}" Text="{Binding SelectedApplicationViewInfo.TranslatedName}" Foreground="{DynamicResource GrayBrush3}" Margin="0" />
503503
</Border>
504504
<ContentControl x:Name="contentControlApplication" Grid.Row="1" Focusable="False" />
505505
</Grid>

‎Source/NETworkManager/Resources/Styles/DragablzStyles.xaml‎

Lines changed: 71 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,83 +13,105 @@
1313
</Setter.Value>
1414
</Setter>
1515
</Style>
16-
17-
<Style TargetType="{x:Type Button}" x:Key="MahAppsMenuCommandButtonStyle">
16+
17+
<Style x:Key="CustomHeaderItemTemplate" TargetType="{x:Type dragablz:DragablzItem}">
1818
<Setter Property="FocusVisualStyle" Value="{StaticResource MahAppsFocusVisual}"/>
19+
<Setter Property="Foreground" Value="{DynamicResource BlackBrush}"/>
1920
<Setter Property="Background" Value="Transparent"/>
20-
<Setter Property="BorderBrush" Value="Transparent"/>
21-
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
22-
<Setter Property="BorderThickness" Value="0"/>
23-
<Setter Property="HorizontalContentAlignment" Value="Center"/>
24-
<Setter Property="VerticalContentAlignment" Value="Center"/>
25-
<Setter Property="Padding" Value="1"/>
26-
<Setter Property="Opacity" Value=".8"/>
27-
<Setter Property="Width" Value="24"/>
28-
<Setter Property="Height" Value="20"/>
21+
<Setter Property="BorderBrush" Value="{DynamicResource GrayBrush8}"/>
22+
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
23+
<Setter Property="VerticalContentAlignment" Value="Stretch"/>
2924
<Setter Property="Template">
3025
<Setter.Value>
31-
<ControlTemplate TargetType="{x:Type Button}">
32-
<Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
33-
<ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
34-
</Border>
26+
<ControlTemplate TargetType="{x:Type dragablz:DragablzItem}">
27+
<Grid x:Name="templateRoot" SnapsToDevicePixels="true">
28+
<Border x:Name="Rectangle" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
29+
<Grid>
30+
<Grid.ColumnDefinitions>
31+
<ColumnDefinition Width="*" />
32+
<ColumnDefinition Width="Auto" />
33+
</Grid.ColumnDefinitions>
34+
<ContentPresenter Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}" ContentStringFormat="{TemplateBinding ContentControl.ContentStringFormat}" HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding Control.VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}" Margin="{TemplateBinding Control.Padding }" x:Name="contentPresenter" />
35+
<Thumb Grid.Column="0" HorizontalAlignment="Stretch" VerticalContentAlignment="Stretch" x:Name="PART_Thumb" Style="{StaticResource MahAppsInvisibleThumbStyle}" />
36+
</Grid>
37+
</Border>
38+
</Grid>
3539
<ControlTemplate.Triggers>
36-
<Trigger Property="IsDefaulted" Value="true">
37-
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
38-
</Trigger>
39-
<Trigger Property="IsEnabled" Value="false">
40-
<Setter Property="Opacity" TargetName="border" Value=".5"/>
40+
<Trigger Property="dragablz:TabablzControl.IsWrappingTabItem" Value="True">
41+
<Setter TargetName="contentPresenter" Property="Content" Value="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DataContext.Header}" />
4142
</Trigger>
4243
</ControlTemplate.Triggers>
4344
</ControlTemplate>
4445
</Setter.Value>
4546
</Setter>
46-
<Style.Triggers>
47-
<Trigger Property="IsMouseOver" Value="true">
48-
<Setter Property="Background" Value="{x:Static dragablz:DragablzColors.WindowGlassBrush}"/>
49-
<Setter Property="Foreground" Value="{x:Static SystemColors.HighlightTextBrush}" />
50-
</Trigger>
51-
<Trigger Property="IsPressed" Value="true">
52-
<Setter Property="Opacity" Value="1"/>
53-
</Trigger>
54-
</Style.Triggers>
5547
</Style>
5648

57-
<Style TargetType="{x:Type Button}" x:Key="AddItemCommandButtonStyle" BasedOn="{StaticResource MahAppsMenuCommandButtonStyle}">
58-
<Setter Property="Template">
59-
<Setter.Value>
60-
<ControlTemplate>
61-
<Rectangle Width="16" Height="16" Margin="10,5,0,5" Fill="{DynamicResource GrayBrush3}">
62-
<Rectangle.OpacityMask>
63-
<VisualBrush Stretch="Uniform" Visual="{IconPacks:PackIconMaterial Kind=Close}" />
64-
</Rectangle.OpacityMask>
65-
</Rectangle>
66-
</ControlTemplate>
67-
</Setter.Value>
68-
</Setter>
69-
</Style>
70-
71-
<Style TargetType="{x:Type dragablz:TabablzControl}" BasedOn="{StaticResource MahAppsTabablzControlStyle}" >
49+
<Style x:Key="DefaultTabablzControl" TargetType="{x:Type dragablz:TabablzControl}" BasedOn="{StaticResource MahAppsTabablzControlStyle}" >
7250
<Setter Property="BorderBrush" Value="{DynamicResource GrayBrush8}" />
7351
<Setter Property="BorderThickness" Value="0,1,0,0" />
74-
<Setter Property="ShowDefaultAddButton" Value="True" />
52+
<Setter Property="ItemContainerStyle" Value="{StaticResource CustomHeaderItemTemplate}" />
53+
<Setter Property="AdjacentHeaderItemOffset" Value="0" />
7554
<Setter Property="HeaderItemTemplate">
7655
<Setter.Value>
7756
<DataTemplate>
7857
<StackPanel Orientation="Horizontal">
7958
<Grid>
80-
<TextBlock Text="{Binding}" FontSize="18" Style="{StaticResource HeaderTextBlock}" Margin="0" />
59+
<TextBlock Text="{Binding}" VerticalAlignment="Center" Margin="10">
60+
<TextBlock.Style>
61+
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource HeaderTextBlock}">
62+
<Setter Property="FontSize" Value="18" />
63+
<Setter Property="Foreground" Value="{DynamicResource GrayBrush3}" />
64+
<Style.Triggers>
65+
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type dragablz:DragablzItem}}, Path=IsSelected}" Value="True">
66+
<Setter Property="Foreground" Value="{DynamicResource AccentColorBrush}" />
67+
</DataTrigger>
68+
</Style.Triggers>
69+
</Style>
70+
</TextBlock.Style>
71+
</TextBlock>
8172
<Thumb Style="{DynamicResource InvisibleThumbStyle}" dragablz:DragablzItem.IsCustomThumb="True" />
8273
</Grid>
83-
<Button Style="{StaticResource CleanButton}" Command="dragablz:TabablzControl.CloseItemCommand">
84-
<Rectangle Width="16" Height="16" Margin="10,5,0,5" Fill="{DynamicResource GrayBrush3}">
74+
<Button Style="{StaticResource CleanButton}" Command="dragablz:TabablzControl.CloseItemCommand" Margin="0,0,10,0">
75+
<Rectangle Width="16" Height="16">
8576
<Rectangle.OpacityMask>
86-
<VisualBrush Stretch="Uniform" Visual="{IconPacks:PackIconMaterial Kind=Close}" />
77+
<VisualBrush Stretch="Uniform" Visual="{IconPacks:PackIconMaterial Kind=WindowClose}" />
8778
</Rectangle.OpacityMask>
79+
<Rectangle.Style>
80+
<Style TargetType="{x:Type Rectangle}">
81+
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
82+
<Style.Triggers>
83+
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
84+
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
85+
</DataTrigger>
86+
</Style.Triggers>
87+
</Style>
88+
</Rectangle.Style>
8889
</Rectangle>
8990
</Button>
9091
</StackPanel>
9192
</DataTemplate>
9293
</Setter.Value>
9394
</Setter>
95+
<Setter Property="HeaderSuffixContent" >
96+
<Setter.Value>
97+
<Button HorizontalAlignment="Right" VerticalAlignment="Center" Style="{StaticResource CleanButton}" Command="dragablz:TabablzControl.AddItemCommand" Margin="10">
98+
<Rectangle Width="20" Height="20">
99+
<Rectangle.OpacityMask>
100+
<VisualBrush Stretch="Uniform" Visual="{IconPacks:PackIconMaterial Kind=Plus}" />
101+
</Rectangle.OpacityMask>
102+
<Rectangle.Style>
103+
<Style TargetType="{x:Type Rectangle}">
104+
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
105+
<Style.Triggers>
106+
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
107+
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
108+
</DataTrigger>
109+
</Style.Triggers>
110+
</Style>
111+
</Rectangle.Style>
112+
</Rectangle>
113+
</Button>
114+
</Setter.Value>
115+
</Setter>
94116
</Style>
95117
</ResourceDictionary>

‎Source/NETworkManager/Views/Applications/RemoteDesktopView.xaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
88
mc:Ignorable="d">
99
<Grid>
10-
<dragablz:TabablzControl>
10+
<dragablz:TabablzControl Style="{StaticResource DefaultTabablzControl}">
1111
<TabItem Header="One">
1212
<Button HorizontalAlignment="Center" VerticalAlignment="Center">Hello World</Button>
1313
</TabItem>

0 commit comments

Comments
 (0)