style<Dashboard>: change style for Workspace switcher

This commit is contained in:
leo 2021-08-13 11:15:30 +08:00
parent aed3c10aa4
commit 5c892a96e6
4 changed files with 47 additions and 3 deletions

View file

@ -31,6 +31,44 @@
</Setter>
</Style>
<Style x:Key="Style.ListViewItem.Switcher" TargetType="{x:Type ListViewItem}">
<Setter Property="Opacity" Value=".9"/>
<Setter Property="Padding" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="RenderOptions.ClearTypeHint" Value="Enabled"/>
<Setter Property="TextElement.FontFamily" Value="{Binding Source={x:Static models:Preference.Instance}, Path=General.FontFamilyContent, Mode=OneWay}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListViewItem}">
<Grid>
<Border x:Name="BG" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true" Background="Transparent">
<ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Border>
<Border x:Name="Border" BorderBrush="{DynamicResource Brush.FG2}" BorderThickness="0"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter TargetName="Border" Property="BorderThickness" Value="4,0,0,0"/>
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.SwitcherBG}"/>
<Setter Property="Opacity" Value="1"/>
<Setter Property="TextElement.FontWeight" Value="Bold"/>
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True"/>
<Condition Property="IsSelected" Value="False"/>
</MultiTrigger.Conditions>
<Setter TargetName="BG" Property="Background" Value="{DynamicResource Brush.SwitcherHover}"/>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="{x:Type ListView}">
<Setter Property="SnapsToDevicePixels" Value="true" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />

View file

@ -25,4 +25,7 @@
<SolidColorBrush x:Key="Brush.FG3" Color="#FF252525"/>
<SolidColorBrush x:Key="Brush.Accent1" Color="#FF007ACC"/>
<SolidColorBrush x:Key="Brush.Accent2" Color="#4C007ACC"/>
<SolidColorBrush x:Key="Brush.SwitcherHover" Color="#FF323232"/>
<SolidColorBrush x:Key="Brush.SwitcherBG" Color="#FF3F3F3F"/>
</ResourceDictionary>

View file

@ -25,4 +25,7 @@
<SolidColorBrush x:Key="Brush.FG3" Color="#FFFFFFFF"/>
<SolidColorBrush x:Key="Brush.Accent1" Color="#FF4295FF"/>
<SolidColorBrush x:Key="Brush.Accent2" Color="#4C007ACC"/>
<SolidColorBrush x:Key="Brush.SwitcherHover" Color="#FFDFDFDF"/>
<SolidColorBrush x:Key="Brush.SwitcherBG" Color="#FFCFCFCF"/>
</ResourceDictionary>

View file

@ -127,13 +127,13 @@
<!-- Workspace -->
<TextBlock Grid.Row="0" Style="{DynamicResource Style.TextBlock.Group}" Text="{DynamicResource Text.Dashboard.Workspace}"/>
<ListView Grid.Row="1" x:Name="workspace" SelectionMode="Single" SelectionChanged="OnPageSelectionChanged">
<ListViewItem IsSelected="True" Opacity=".9">
<ListViewItem IsSelected="True" Style="{DynamicResource Style.ListViewItem.Switcher}">
<StackPanel Margin="16,0,0,0" Height="28" Orientation="Horizontal">
<Path Width="16" Height="16" Data="{StaticResource Icon.Histories}"/>
<TextBlock Margin="8,0,0,0" Text="{DynamicResource Text.Histories}"/>
</StackPanel>
</ListViewItem>
<ListViewItem Opacity=".9">
<ListViewItem Style="{DynamicResource Style.ListViewItem.Switcher}">
<Grid Margin="16,0,0,0" Height="28">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
@ -145,7 +145,7 @@
<controls:Badge Grid.Column="2" Margin="4,0" x:Name="badgeLocalChanges"/>
</Grid>
</ListViewItem>
<ListViewItem Opacity=".9">
<ListViewItem Style="{DynamicResource Style.ListViewItem.Switcher}">
<Grid Margin="16,0,0,0" Height="28">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>