Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Slider styles #1154

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions src/library/Uno.Material/Styles/Controls/v2/Slider.xaml
Original file line number Diff line number Diff line change
@@ -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"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:not_win="http://uno.ui/not_win"
Expand All @@ -22,8 +22,8 @@
<StaticResource x:Key="SliderTrackFillDisabled" ResourceKey="OnSurfaceSelectedBrush" />
<StaticResource x:Key="SliderTrackValueFill" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="SliderTrackValueFillDisabled" ResourceKey="SystemControlDisabledChromeDisabledHighBrush" />
<CornerRadius x:Key="SliderHorizontalFillCornerRadius">4,0,0,4</CornerRadius>
<CornerRadius x:Key="SliderVerticalFillCornerRadius">0,0,4,4</CornerRadius>
<CornerRadius x:Key="SliderHorizontalFillCornerRadius">3,0,0,3</CornerRadius>
<CornerRadius x:Key="SliderVerticalFillCornerRadius">0,0,3,3</CornerRadius>
<x:Double x:Key="SliderTrackThickness">4</x:Double>
<x:Double x:Key="SliderFillThickness">6</x:Double>

Expand All @@ -48,9 +48,10 @@
<x:Double x:Key="SliderThumbWidth">20</x:Double>
<x:Double x:Key="SliderThumbHeight">20</x:Double>
<x:Double x:Key="SliderThumbCornerRadius">10</x:Double>
<Thickness x:Key="SliderThumbMargin">-1</Thickness>
<Thickness x:Key="SliderHorizontalFocusVisualMargin">-14,-6,-14,-6</Thickness>
<Thickness x:Key="SliderVerticalFocusVisualMargin">-6,-14,-6,-14</Thickness>
<StaticResource x:Key="SliderTrackCornerRadius" ResourceKey="ControlCornerRadius" />
<CornerRadius x:Key="SliderTrackCornerRadius">2</CornerRadius>
</ResourceDictionary>

<!-- Dark Theme -->
Expand All @@ -70,8 +71,8 @@
<StaticResource x:Key="SliderTrackFillDisabled" ResourceKey="OnSurfaceSelectedBrush" />
<StaticResource x:Key="SliderTrackValueFill" ResourceKey="PrimaryBrush" />
<StaticResource x:Key="SliderTrackValueFillDisabled" ResourceKey="SystemControlDisabledChromeDisabledHighBrush" />
<CornerRadius x:Key="SliderHorizontalFillCornerRadius">4,0,0,4</CornerRadius>
<CornerRadius x:Key="SliderVerticalFillCornerRadius">0,0,4,4</CornerRadius>
<CornerRadius x:Key="SliderHorizontalFillCornerRadius">3,0,0,3</CornerRadius>
<CornerRadius x:Key="SliderVerticalFillCornerRadius">0,0,3,3</CornerRadius>
<x:Double x:Key="SliderTrackThickness">4</x:Double>
<x:Double x:Key="SliderFillThickness">6</x:Double>

Expand All @@ -96,9 +97,10 @@
<x:Double x:Key="SliderThumbWidth">20</x:Double>
<x:Double x:Key="SliderThumbHeight">20</x:Double>
<x:Double x:Key="SliderThumbCornerRadius">10</x:Double>
<StaticResource x:Key="SliderTrackCornerRadius" ResourceKey="ControlCornerRadius" />
<Thickness x:Key="SliderThumbMargin">-1</Thickness>
Copy link
Contributor

@agneszitte agneszitte Aug 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if negative margin is the way to go here as it is affecting the thumb position to be perfectly centered for the proper value (for example moving the thumb on slider value 50 will move the thumb centered to 49 with this change I think). Will need to be verified

<Thickness x:Key="SliderHorizontalFocusVisualMargin">-14,-6,-14,-6</Thickness>
<Thickness x:Key="SliderVerticalFocusVisualMargin">-6,-14,-6,-14</Thickness>
<CornerRadius x:Key="SliderTrackCornerRadius">2</CornerRadius>
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>

Expand Down Expand Up @@ -283,7 +285,8 @@
AutomationProperties.AccessibilityView="Raw"
DataContext="{TemplateBinding Value}"
FocusVisualMargin="{ThemeResource SliderHorizontalFocusVisualMargin}"
Style="{StaticResource MaterialSliderThumbStyle}" />
Style="{StaticResource MaterialSliderThumbStyle}"
Margin="{ThemeResource SliderThumbMargin}" />
</Grid>

<!-- VerticalTemplate -->
Expand Down Expand Up @@ -358,7 +361,8 @@
AutomationProperties.AccessibilityView="Raw"
DataContext="{TemplateBinding Value}"
FocusVisualMargin="{ThemeResource SliderVerticalFocusVisualMargin}"
Style="{StaticResource MaterialSliderThumbStyle}" />
Style="{StaticResource MaterialSliderThumbStyle}"
Margin="{ThemeResource SliderThumbMargin}" />
</Grid>
</Grid>
</Grid>
Expand Down