Skip to content

Portable Tool for an Ideal Windows Setup

add visible scrollbar and clear selection indicator to ComboBox dropdown

Greedekscba28e0fd8a1
diff --git a/.Source/GTweak/Styles/Inputs/ComboBox.xaml b/.Source/GTweak/Styles/Inputs/ComboBox.xaml
index 4359fb1e..921c1224 100644
--- a/.Source/GTweak/Styles/Inputs/ComboBox.xaml
+++ b/.Source/GTweak/Styles/Inputs/ComboBox.xaml
@@ -1,21 +1,28 @@
-<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style x:Key="CustomComboBoxItemStyle" TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="Foreground" Value="{StaticResource Brush_Highlighted}"/>
<Setter Property="IsTabStop" Value="False"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
+ <Setter Property="Padding" Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBoxItem">
- <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="Transparent" BorderThickness="2,0,0,0" CornerRadius="3">
- <ContentPresenter x:Name="ContentPresenter" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
- </ContentPresenter>
+ <Border x:Name="BackgroundBorder" Background="Transparent" CornerRadius="3">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="6"/>
+ <ColumnDefinition/>
+ </Grid.ColumnDefinitions>
+ <Border x:Name="Indicator" Grid.Column="0" Width="3" Height="16" CornerRadius="2" Background="Transparent" VerticalAlignment="Center" HorizontalAlignment="Center"/>
+ <ContentPresenter Grid.Column="1" Margin="6,7.5" VerticalAlignment="Center"/>
+ </Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
- <Setter TargetName="Border" Property="Background" Value="{StaticResource Brush_ComboBoxBG_Active}"/>
- <Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource Brush_Accent}"/>
+ <Setter TargetName="BackgroundBorder" Property="Background" Value="{StaticResource Brush_ComboBoxBG_Active}"/>
+ <Setter TargetName="Indicator" Property="Background" Value="{StaticResource Brush_Accent}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="{StaticResource Brush_Accent}"/>
@@ -26,9 +33,57 @@
</Setter>
</Style>
+ <Style x:Key="ComboBoxArrowToggle" TargetType="ToggleButton">
+ <Setter Property="Focusable" Value="False"/>
+ <Setter Property="Width" Value="28"/>
+ <Setter Property="Height" Value="28"/>
+ <Setter Property="Background" Value="Transparent"/>
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="ToggleButton">
+ <Grid Background="Transparent">
+ <Path x:Name="Arrow" Data="M 0,2 L 4,6 L 8,2" Stroke="{StaticResource Brush_Highlighted}" StrokeThickness="1" StrokeStartLineCap="Round" StrokeEndLineCap="Round" StrokeLineJoin="Round" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
+ <Path.RenderTransform>
+ <RotateTransform x:Name="Rotate" Angle="0"/>
+ </Path.RenderTransform>
+ </Path>
+ </Grid>
+ <ControlTemplate.Triggers>
+ <Trigger Property="IsChecked" Value="True">
+ <Trigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard Timeline.DesiredFrameRate="120">
+ <DoubleAnimation Storyboard.TargetName="Rotate" Storyboard.TargetProperty="Angle" To="180" Duration="0:0:0.25">
+ <DoubleAnimation.EasingFunction>
+ <CubicEase/>
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.EnterActions>
+ <Trigger.ExitActions>
+ <BeginStoryboard>
+ <Storyboard Timeline.DesiredFrameRate="120">
+ <DoubleAnimation Storyboard.TargetName="Rotate" Storyboard.TargetProperty="Angle" To="0" Duration="0:0:0.25">
+ <DoubleAnimation.EasingFunction>
+ <CubicEase/>
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.ExitActions>
+ </Trigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
<Style x:Key="CustomComboBoxStyle" TargetType="ComboBox" BasedOn="{StaticResource {x:Type ComboBox}}">
<Setter Property="FontFamily" Value="{StaticResource Jura}"/>
<Setter Property="Width" Value="165"/>
+ <Setter Property="Height" Value="28"/>
<Setter Property="BorderBrush" Value="{StaticResource Brush_Separator}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="MaxDropDownHeight" Value="220"/>
@@ -38,10 +93,87 @@
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
- <TextBlock Text="{Binding Display}" FontSize="13px"/>
+ <TextBlock Text="{Binding Display}" FontSize="13.5"/>
</DataTemplate>
</Setter.Value>
</Setter>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="ComboBox">
+ <Grid>
+ <Border x:Name="Border"
+ Background="{TemplateBinding Background}"
+ BorderBrush="{TemplateBinding BorderBrush}"
+ BorderThickness="{TemplateBinding BorderThickness}"
+ CornerRadius="3">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition/>
+ <ColumnDefinition Width="Auto"/>
+ </Grid.ColumnDefinitions>
+ <ContentPresenter Grid.Column="0" Margin="8,0" VerticalAlignment="Center" IsHitTestVisible="True" Content="{Binding SelectedItem, RelativeSource={RelativeSource TemplatedParent}}">
+ <ContentPresenter.ContentTemplate>
+ <DataTemplate>
+ <TextBlock Text="{Binding Display}"/>
+ </DataTemplate>
+ </ContentPresenter.ContentTemplate>
+ </ContentPresenter>
+ <ToggleButton Grid.Column="1" IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxArrowToggle}"/>
+ <ToggleButton Grid.Column="0" Grid.ColumnSpan="2" Background="Transparent" BorderBrush="Transparent" BorderThickness="0" IsChecked="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
+ <ToggleButton.Style>
+ <Style TargetType="ToggleButton">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="ToggleButton">
+ <Border Background="Transparent"/>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ </ToggleButton.Style>
+ </ToggleButton>
+ </Grid>
+ </Border>
+ <Popup x:Name="Popup" IsOpen="{TemplateBinding IsDropDownOpen}" Placement="Bottom" VerticalOffset="1" AllowsTransparency="True" Focusable="False">
+ <Border x:Name="PopupBorder"
+ Width="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}"
+ Background="{StaticResource Brush_Background_СomboBox}"
+ BorderBrush="{TemplateBinding BorderBrush}"
+ BorderThickness="{TemplateBinding BorderThickness}"
+ CornerRadius="5"
+ Opacity="1"
+ ClipToBounds="True"
+ RenderTransformOrigin="0,0">
+ <Border.RenderTransform>
+ <ScaleTransform x:Name="PopupScaleTransform" ScaleY="0" CenterY="0"/>
+ </Border.RenderTransform>
+ <ScrollViewer MaxHeight="{TemplateBinding MaxDropDownHeight}" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled" Padding="0" Margin="0">
+ <ItemsPresenter Margin="0,0,8,0"/>
+ </ScrollViewer>
+ </Border>
+ </Popup>
+ </Grid>
+ <ControlTemplate.Triggers>
+ <EventTrigger RoutedEvent="ToggleButton.Checked">
+ <BeginStoryboard>
+ <Storyboard Timeline.DesiredFrameRate="120">
+ <DoubleAnimation Storyboard.TargetName="PopupBorder" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0.1">
+ <DoubleAnimation.EasingFunction>
+ <QuadraticEase/>
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ <DoubleAnimation Storyboard.TargetName="PopupScaleTransform" Storyboard.TargetProperty="ScaleY" From="0" To="1" Duration="0:0:0.2">
+ <DoubleAnimation.EasingFunction>
+ <CubicEase EasingMode="EaseOut"/>
+ </DoubleAnimation.EasingFunction>
+ </DoubleAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </EventTrigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
</Style>
</ResourceDictionary>
\ No newline at end of file
diff --git a/.Source/GTweak/Styles/Themes/Dark/Colors.xaml b/.Source/GTweak/Styles/Themes/Dark/Colors.xaml
index b1951a2f..d386226c 100644
--- a/.Source/GTweak/Styles/Themes/Dark/Colors.xaml
+++ b/.Source/GTweak/Styles/Themes/Dark/Colors.xaml
@@ -1,4 +1,4 @@
-<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Color x:Key="Color_Accent">#7BFFB5</Color>
@@ -23,6 +23,7 @@
<SolidColorBrush x:Key="Brush_Separator" Color="#434544"/>
+ <SolidColorBrush x:Key="Brush_Background_СomboBox" Color="#2C2E2D"/>
<SolidColorBrush x:Key="Brush_ComboBoxBorder_Hover" Color="#65ffa9"/>
<SolidColorBrush x:Key="Brush_ComboBoxBG_Active" Color="#3b3b3b"/>
diff --git a/.Source/GTweak/Styles/Themes/Light/Colors.xaml b/.Source/GTweak/Styles/Themes/Light/Colors.xaml
index 6e6dd4bc..0827f228 100644
--- a/.Source/GTweak/Styles/Themes/Light/Colors.xaml
+++ b/.Source/GTweak/Styles/Themes/Light/Colors.xaml
@@ -1,4 +1,4 @@
-<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Color x:Key="Color_Accent">#00A15A</Color>
@@ -23,6 +23,7 @@
<SolidColorBrush x:Key="Brush_Separator" Color="#C8C8C8"/>
+ <SolidColorBrush x:Key="Brush_Background_СomboBox" Color="#F9F9F9"/>
<SolidColorBrush x:Key="Brush_ComboBoxBorder_Hover" Color="#008C47"/>
<SolidColorBrush x:Key="Brush_ComboBoxBG_Active" Color="#E0E0E0"/>