Skip to content

Commit

Permalink
Merge pull request #4052 from MahApps/fix/GH-4030
Browse files Browse the repository at this point in the history
(GH-4030) Fix ToggleSwitch Right Alignment
  • Loading branch information
punker76 authored Feb 25, 2021
2 parents 3e73465 + 039988c commit 4836329
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/MahApps.Metro/Styles/Controls.ContextMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>

<ContextMenu x:Key="MahApps.TextBox.ContextMenu" Style="{StaticResource MahApps.Styles.ContextMenu}" x:Shared="False">
<ContextMenu x:Key="MahApps.TextBox.ContextMenu"
x:Shared="False"
Style="{StaticResource MahApps.Styles.ContextMenu}">
<MenuItem Command="ApplicationCommands.Cut" Style="{DynamicResource MahApps.Styles.MenuItem}" />
<MenuItem Command="ApplicationCommands.Copy" Style="{DynamicResource MahApps.Styles.MenuItem}" />
<MenuItem Command="ApplicationCommands.Paste" Style="{DynamicResource MahApps.Styles.MenuItem}" />
Expand Down
4 changes: 3 additions & 1 deletion src/MahApps.Metro/Styles/VS/ContextMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@
<Setter Property="VerticalContentAlignment" Value="Center" />
</Style>

<ContextMenu x:Key="MahApps.TextBox.ContextMenu" Style="{StaticResource MahApps.Styles.ContextMenu.VisualStudio}" x:Shared="False">
<ContextMenu x:Key="MahApps.TextBox.ContextMenu"
x:Shared="False"
Style="{StaticResource MahApps.Styles.ContextMenu.VisualStudio}">
<MenuItem Command="ApplicationCommands.Cut" Style="{DynamicResource MahApps.Styles.MenuItem.VisualStudio}" />
<MenuItem Command="ApplicationCommands.Copy" Style="{DynamicResource MahApps.Styles.MenuItem.VisualStudio}" />
<MenuItem Command="ApplicationCommands.Paste" Style="{DynamicResource MahApps.Styles.MenuItem.VisualStudio}" />
Expand Down
6 changes: 4 additions & 2 deletions src/MahApps.Metro/Themes/ToggleSwitch.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.ToggleSwitch.ContentForeground}" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="MinWidth" Value="{DynamicResource ToggleSwitchThemeMinWidth}" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
Expand Down Expand Up @@ -55,8 +56,8 @@
TextElement.Foreground="{TemplateBinding mah:HeaderedControlHelper.HeaderForeground}"
Visibility="Collapsed" />

<Grid Grid.Row="1"
MinWidth="{DynamicResource ToggleSwitchThemeMinWidth}"
<Grid x:Name="SwitchContentGrid"
Grid.Row="1"
HorizontalAlignment="Left"
VerticalAlignment="Top">

Expand Down Expand Up @@ -345,6 +346,7 @@
<Setter TargetName="OffContentPresenter" Property="Grid.Column" Value="0" />
<Setter TargetName="OnContentPresenter" Property="Grid.Column" Value="0" />
<Setter TargetName="Switch" Property="Grid.Column" Value="2" />
<Setter TargetName="SwitchContentGrid" Property="HorizontalAlignment" Value="Right" />
</Trigger>

<!-- MouseOver -->
Expand Down

0 comments on commit 4836329

Please sign in to comment.