Skip to content

Commit

Permalink
Fix #197: Problem with MinWidth property of the ToggleSwitch
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara committed Nov 12, 2020
1 parent fce6cac commit 0407148
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
11 changes: 3 additions & 8 deletions ModernWpf.Controls/ToggleSwitch/ToggleSwitch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
xmlns:local="clr-namespace:ModernWpf.Controls"
xmlns:sys="clr-namespace:System;assembly=mscorlib">

<GridLength x:Key="ToggleSwitchPreContentMargin">6</GridLength>
<GridLength x:Key="ToggleSwitchPostContentMargin">6</GridLength>

<sys:Double x:Key="ToggleSwitchThemeMinWidth">154</sys:Double>

<sys:TimeSpan x:Key="RepositionDelay">0:0:0.033</sys:TimeSpan>
<KeyTime x:Key="RepositionDuration">0:0:0.367</KeyTime>
<KeySpline x:Key="RepositionKeySpline">0.1,0.9 0.2,1.0</KeySpline>
Expand Down Expand Up @@ -196,14 +191,14 @@
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
<Grid
Grid.Row="1"
MinWidth="{StaticResource ToggleSwitchThemeMinWidth}"
MinWidth="{DynamicResource ToggleSwitchThemeMinWidth}"
HorizontalAlignment="Left"
VerticalAlignment="Top">

<Grid.RowDefinitions>
<RowDefinition Height="{StaticResource ToggleSwitchPreContentMargin}" />
<RowDefinition ui:RowDefinitionHelper.PixelHeight="{DynamicResource ToggleSwitchPreContentMargin}" />
<RowDefinition Height="Auto" />
<RowDefinition Height="{StaticResource ToggleSwitchPostContentMargin}" />
<RowDefinition ui:RowDefinitionHelper.PixelHeight="{DynamicResource ToggleSwitchPostContentMargin}" />
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
Expand Down
3 changes: 3 additions & 0 deletions ModernWpf/ControlsResources.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@
<Thickness x:Key="RadioButtonsTopHeaderMargin">0,0,0,4</Thickness>
<Thickness x:Key="TextControlThemePadding">10,5,6,6</Thickness>
<Thickness x:Key="ToggleSwitchTopHeaderMargin">0,0,0,0</Thickness>
<sys:Double x:Key="ToggleSwitchPreContentMargin">6</sys:Double>
<sys:Double x:Key="ToggleSwitchPostContentMargin">6</sys:Double>
<sys:Double x:Key="ToggleSwitchThemeMinWidth">154</sys:Double>

<ControlTemplate x:Key="TextControlValidationErrorTemplate">
<Grid SnapsToDevicePixels="True">
Expand Down

0 comments on commit 0407148

Please sign in to comment.