Skip to content

Commit

Permalink
fix(ToggleSwitch): Override ToggleSwitch MinWidth (#1237)
Browse files Browse the repository at this point in the history
  • Loading branch information
eriklimakc authored Oct 10, 2023
1 parent ea69fe6 commit 87368bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/library/Uno.Cupertino/Styles/Controls/ToggleSwitch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
Color="{ThemeResource CupertinoWhiteColor}" />
<SolidColorBrush x:Key="CupertinoToggleSwitchOnBackgroundBrush"
Color="{ThemeResource CupertinoGreenColor}" />

<x:Double x:Key="ToggleSwitchThemeMinWidth">0</x:Double>

<Style x:Key="DefaultCupertinoToggleSwitchStyle"
TargetType="ToggleSwitch">
Expand All @@ -25,6 +27,8 @@
Value="{ThemeResource CupertinoToggleSwitchOnButtonBrush}" />
<Setter Property="Background"
Value="{ThemeResource CupertinoToggleSwitchOnBackgroundBrush}" />
<Setter Property="MinWidth"
Value="{ThemeResource ToggleSwitchThemeMinWidth}" />

<Setter Property="HorizontalAlignment"
Value="Left" />
Expand Down
4 changes: 4 additions & 0 deletions src/library/Uno.Material/Styles/Controls/v2/ToggleSwitch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
<x:Double x:Key="MediumThumbSize">24</x:Double>
<x:Double x:Key="LargeThumbSize">28</x:Double>
<x:Double x:Key="KnobIconSize">16</x:Double>
<x:Double x:Key="ToggleSwitchThemeMinWidth">0</x:Double>

<CornerRadius x:Key="LargeThumbCornerRadius">14</CornerRadius>

Expand Down Expand Up @@ -109,6 +110,7 @@
<x:Double x:Key="MediumThumbSize">24</x:Double>
<x:Double x:Key="LargeThumbSize">28</x:Double>
<x:Double x:Key="KnobIconSize">16</x:Double>
<x:Double x:Key="ToggleSwitchThemeMinWidth">0</x:Double>

<CornerRadius x:Key="LargeThumbCornerRadius">14</CornerRadius>

Expand Down Expand Up @@ -153,6 +155,8 @@
<Setter Property="OnContent" Value="{x:Null}" />
<Setter Property="OffContent" Value="{x:Null}" />

<Setter Property="MinWidth" Value="{ThemeResource ToggleSwitchThemeMinWidth}" />

<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleSwitch">
Expand Down

0 comments on commit 87368bc

Please sign in to comment.