Skip to content

Portable Tool for an Ideal Windows Setup

upd. unify dropdown toggle styles & ref

Greedeks9f1637f62373
diff --git a/.Source/GTweak/Assets/UserControls/ColorPicker.xaml b/.Source/GTweak/Assets/UserControls/ColorPicker.xaml
index bbd07d09..91d9737a 100644
--- a/.Source/GTweak/Assets/UserControls/ColorPicker.xaml
+++ b/.Source/GTweak/Assets/UserControls/ColorPicker.xaml
@@ -9,87 +9,19 @@
d:DesignHeight="40" d:DesignWidth="140" UseLayoutRounding="True" SnapsToDevicePixels="True" KeyboardNavigation.TabNavigation="None"
IsTabStop="False" Focusable="False" PreviewKeyDown="ColorPopup_PreviewKeyDown">
<Grid>
- <ToggleButton x:Name="TglArrow" Checked="TglArrow_Checked" Unchecked="TglArrow_Unchecked" Focusable="False">
- <ToggleButton.Template>
- <ControlTemplate TargetType="ToggleButton">
- <Border x:Name="RootBorder" BorderThickness="1" Background="{StaticResource Brush_Background_ComboBox}" CornerRadius="4" Padding="5">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="BorderBrush">
- <Setter.Value>
- <SolidColorBrush Color="{StaticResource Color_Separator}" />
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Trigger.EnterActions>
- <BeginStoryboard>
- <Storyboard Timeline.DesiredFrameRate="120">
- <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource Color_Border_Hover_CheckBox}" Duration="0:0:0.1"/>
- </Storyboard>
- </BeginStoryboard>
- </Trigger.EnterActions>
- <Trigger.ExitActions>
- <BeginStoryboard>
- <Storyboard Timeline.DesiredFrameRate="120">
- <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource Color_Separator}" Duration="0:0:0.1"/>
- </Storyboard>
- </BeginStoryboard>
- </Trigger.ExitActions>
- </Trigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
- <ContentPresenter Grid.Column="0" VerticalAlignment="Center"/>
- <Path x:Name="Arrow" Grid.Column="1" Data="M 0,2 L 4,6 L 8,2" Stroke="{StaticResource Brush_Highlighted}" StrokeThickness="1" Margin="8,0,2,0" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
- <Path.RenderTransform>
- <RotateTransform x:Name="ArrowRotate" Angle="0"/>
- </Path.RenderTransform>
- </Path>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsChecked" Value="True">
- <Trigger.EnterActions>
- <BeginStoryboard>
- <Storyboard Timeline.DesiredFrameRate="120">
- <DoubleAnimation Storyboard.TargetName="ArrowRotate" Storyboard.TargetProperty="Angle" To="180" Duration="0:0:0.2">
- <DoubleAnimation.EasingFunction>
- <CubicEase/>
- </DoubleAnimation.EasingFunction>
- </DoubleAnimation>
- </Storyboard>
- </BeginStoryboard>
- </Trigger.EnterActions>
- <Trigger.ExitActions>
- <BeginStoryboard>
- <Storyboard Timeline.DesiredFrameRate="120">
- <DoubleAnimation Storyboard.TargetName="ArrowRotate" Storyboard.TargetProperty="Angle" To="0" Duration="0:0:0.2">
- <DoubleAnimation.EasingFunction>
- <CubicEase/>
- </DoubleAnimation.EasingFunction>
- </DoubleAnimation>
- </Storyboard>
- </BeginStoryboard>
- </Trigger.ExitActions>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </ToggleButton.Template>
-
+ <ToggleButton x:Name="TglArrow" Style="{StaticResource TglDropDown}" Checked="TglArrow_Checked" Unchecked="TglArrow_Unchecked" PreviewMouseRightButtonDown="TglArrow_PreviewMouseRightButtonDown">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
+ <Ellipse Grid.Column="0" Fill="#33000000" Width="20" Height="20" Margin="0,0,8,0" Opacity="0.7">
+ <Ellipse.RenderTransform>
+ <TranslateTransform X="1" Y="1" />
+ </Ellipse.RenderTransform>
+ </Ellipse>
<Ellipse x:Name="ColorPreview" Grid.Column="0" Width="20" Height="20" Stroke="{StaticResource Brush_Separator}" StrokeThickness="2" Margin="0,0,8,0" Fill="White"/>
-
<TextBlock x:Name="ColorTextBlock" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="14px" FontFamily="{StaticResource Play}" Foreground="{StaticResource Brush_Highlighted}" Text="255 255 255" MinWidth="80" Typography.NumeralAlignment="Tabular" Typography.NumeralStyle="Lining"/>
</Grid>
</ToggleButton>
diff --git a/.Source/GTweak/Assets/UserControls/ColorPicker.xaml.cs b/.Source/GTweak/Assets/UserControls/ColorPicker.xaml.cs
index b07e3bd3..c58238ec 100644
--- a/.Source/GTweak/Assets/UserControls/ColorPicker.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/ColorPicker.xaml.cs
@@ -314,6 +314,7 @@ namespace GTweak.Assets.UserControls
private void ParentWindow_MovedOrResized(object sender, EventArgs e) => UpdatePopupPosition();
private void TglArrow_Checked(object sender, RoutedEventArgs e) => ColorPopup.IsOpen = true;
private void TglArrow_Unchecked(object sender, RoutedEventArgs e) => ColorPopup.IsOpen = false;
+ private void TglArrow_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) => e.Handled = true;
private void BtnDefault_Click(object sender, RoutedEventArgs e)
{
diff --git a/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml b/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml
index 3c2de1f5..1fe174be 100644
--- a/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml
+++ b/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml
@@ -8,76 +8,8 @@
KeyboardNavigation.TabNavigation="None" IsTabStop="False" Focusable="False"
PreviewKeyDown="Popup_PreviewKeyDown">
<Grid>
- <ToggleButton x:Name="TglArrow" Checked="TglArrow_Checked" Unchecked="TglArrow_Unchecked" Focusable="False">
- <ToggleButton.Template>
- <ControlTemplate TargetType="ToggleButton">
- <Border x:Name="RootBorder" BorderThickness="1" Background="{StaticResource Brush_Background_ComboBox}" CornerRadius="4" Padding="10,5">
- <Border.Style>
- <Style TargetType="Border">
- <Setter Property="BorderBrush" Value="{StaticResource Brush_Separator}" />
- <Style.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Trigger.EnterActions>
- <BeginStoryboard>
- <Storyboard Timeline.DesiredFrameRate="120">
- <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource Color_Border_Hover_CheckBox}" Duration="0:0:0.1"/>
- </Storyboard>
- </BeginStoryboard>
- </Trigger.EnterActions>
- <Trigger.ExitActions>
- <BeginStoryboard>
- <Storyboard Timeline.DesiredFrameRate="120">
- <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource Color_Separator}" Duration="0:0:0.1"/>
- </Storyboard>
- </BeginStoryboard>
- </Trigger.ExitActions>
- </Trigger>
- </Style.Triggers>
- </Style>
- </Border.Style>
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="*"/>
- <ColumnDefinition Width="Auto"/>
- </Grid.ColumnDefinitions>
-
- <TextBlock Grid.Column="0" Text="{Binding ElementName=Root, Path=Text}" VerticalAlignment="Center" FontSize="14px" FontFamily="{StaticResource Jura}" Foreground="{StaticResource Brush_Highlighted}" Margin="0,0,10,0"/>
-
- <Path x:Name="Arrow" Grid.Column="1" Data="M 0,2 L 4,6 L 8,2" Stroke="{StaticResource Brush_Highlighted}" StrokeThickness="1" Margin="8,0,2,0" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
- <Path.RenderTransform>
- <RotateTransform x:Name="ArrowRotate" Angle="0"/>
- </Path.RenderTransform>
- </Path>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsChecked" Value="True">
- <Trigger.EnterActions>
- <BeginStoryboard>
- <Storyboard Timeline.DesiredFrameRate="120">
- <DoubleAnimation Storyboard.TargetName="ArrowRotate" Storyboard.TargetProperty="Angle" To="180" Duration="0:0:0.2">
- <DoubleAnimation.EasingFunction>
- <CubicEase/>
- </DoubleAnimation.EasingFunction>
- </DoubleAnimation>
- </Storyboard>
- </BeginStoryboard>
- </Trigger.EnterActions>
- <Trigger.ExitActions>
- <BeginStoryboard>
- <Storyboard Timeline.DesiredFrameRate="120">
- <DoubleAnimation Storyboard.TargetName="ArrowRotate" Storyboard.TargetProperty="Angle" To="0" Duration="0:0:0.2">
- <DoubleAnimation.EasingFunction>
- <CubicEase/>
- </DoubleAnimation.EasingFunction>
- </DoubleAnimation>
- </Storyboard>
- </BeginStoryboard>
- </Trigger.ExitActions>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </ToggleButton.Template>
+ <ToggleButton x:Name="TglArrow" Style="{StaticResource TglDropDown}" Height="31" Padding="10,5" Checked="TglArrow_Checked" Unchecked="TglArrow_Unchecked" PreviewMouseRightButtonDown="TglArrow_PreviewMouseRightButtonDown">
+ <TextBlock Text="{Binding ElementName=Root, Path=Text}" VerticalAlignment="Center" FontSize="14px" FontFamily="{StaticResource Jura}" Foreground="{StaticResource Brush_Highlighted}" Margin="0,0,10,0"/>
</ToggleButton>
<Popup x:Name="DropdownPopup" Placement="Bottom" StaysOpen="False" AllowsTransparency="True" Opened="Popup_Opened" Closed="Popup_Closed" VerticalOffset="2">
diff --git a/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml.cs b/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml.cs
index 36eaf7d0..ebeafba7 100644
--- a/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml.cs
+++ b/.Source/GTweak/Assets/UserControls/ExpandableBox.xaml.cs
@@ -84,6 +84,7 @@ namespace GTweak.Assets.UserControls
private void UpdatePositionProxy(object s, EventArgs e) => UpdatePopupPosition();
private void TglArrow_Checked(object sender, RoutedEventArgs e) => DropdownPopup.IsOpen = true;
private void TglArrow_Unchecked(object sender, RoutedEventArgs e) => DropdownPopup.IsOpen = false;
+ private void TglArrow_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) => e.Handled = true;
private void Popup_PreviewKeyDown(object sender, KeyEventArgs e)
{
diff --git a/.Source/GTweak/Styles/Buttons/ToggleButtons.xaml b/.Source/GTweak/Styles/Buttons/ToggleButtons.xaml
index 2cc11eb4..35bc455e 100644
--- a/.Source/GTweak/Styles/Buttons/ToggleButtons.xaml
+++ b/.Source/GTweak/Styles/Buttons/ToggleButtons.xaml
@@ -377,4 +377,91 @@
</Setter>
</Style>
+ <Style x:Key="TglDropDown" TargetType="{x:Type ToggleButton}">
+ <Setter Property="Focusable" Value="False"/>
+ <Setter Property="Height" Value="32"/>
+ <Setter Property="Padding" Value="5"/>
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type ToggleButton}">
+ <Border x:Name="RootBorder" BorderThickness="1" Background="{StaticResource Brush_Background_ComboBox}" CornerRadius="4" Padding="{TemplateBinding Padding}">
+ <Border.Style>
+ <Style TargetType="{x:Type Border}">
+ <Setter Property="BorderBrush">
+ <Setter.Value>
+ <SolidColorBrush Color="{StaticResource Color_Separator}" />
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <Trigger Property="IsMouseOver" Value="True">
+ <Trigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard Timeline.DesiredFrameRate="120">
+ <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource Color_Border_Hover_CheckBox}" Duration="0:0:0.1">
+ <ColorAnimation.EasingFunction>
+ <QuadraticEase/>
+ </ColorAnimation.EasingFunction>
+ </ColorAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.EnterActions>
+ <Trigger.ExitActions>
+ <BeginStoryboard>
+ <Storyboard Timeline.DesiredFrameRate="120">
+ <ColorAnimation Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" To="{StaticResource Color_Separator}" Duration="0:0:0.1">
+ <ColorAnimation.EasingFunction>
+ <QuadraticEase/>
+ </ColorAnimation.EasingFunction>
+ </ColorAnimation>
+ </Storyboard>
+ </BeginStoryboard>
+ </Trigger.ExitActions>
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="*"/>
+ <ColumnDefinition Width="Auto"/>
+ </Grid.ColumnDefinitions>
+ <ContentPresenter Grid.Column="0" VerticalAlignment="Center"/>
+ <Path x:Name="Arrow" Grid.Column="1" Data="M 0,2 L 4,6 L 8,2" Stroke="{StaticResource Brush_Highlighted}" StrokeThickness="1" Margin="8,0,2,0" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
+ <Path.RenderTransform>
+ <RotateTransform x:Name="ArrowRotate" Angle="0"/>
+ </Path.RenderTransform>
+ </Path>
+ </Grid>
+ </Border>
+ <ControlTemplate.Triggers>
+ <Trigger Property="IsChecked" Value="True">
+ <Trigger.EnterActions>
+ <BeginStoryboard>
+ <Storyboard Timeline.DesiredFrameRate="120">
+ <DoubleAnimation Storyboard.TargetName="ArrowRotate" 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="ArrowRotate" 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>
+
</ResourceDictionary>
\ No newline at end of file