Skip to content

Commit

Permalink
Merge pull request #3610 from mgnslndh/feature/GH-3349
Browse files Browse the repository at this point in the history
(GH-3349) Fix disable content of ToggleButton & Button when using circle style
  • Loading branch information
punker76 committed Sep 19, 2019
2 parents e59402c + bf681af commit 9c721a4
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
Content="Disabled"
IsEnabled="False"
Style="{DynamicResource MahApps.Styles.ToggleButton.Flat}" />

<StackPanel Margin="{StaticResource ControlMargin}"
HorizontalAlignment="Center"
Orientation="Horizontal">
Expand All @@ -117,6 +118,37 @@
Kind="City" />
</ToggleButton>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}"
HorizontalAlignment="Center"
Orientation="Horizontal">
<ToggleButton Width="48"
Height="48"
Margin="4"
Foreground="{DynamicResource MahApps.Brushes.Accent}"
Style="{DynamicResource MahApps.Styles.ToggleButton.Circle}">
<ToggleButton.ContentTemplate>
<DataTemplate>
<iconPacks:PackIconModern Width="20"
Height="20"
Kind="City" />
</DataTemplate>
</ToggleButton.ContentTemplate>
</ToggleButton>
<ToggleButton Width="48"
Height="48"
Margin="4"
Foreground="{DynamicResource MahApps.Brushes.Accent}"
IsEnabled="False"
Style="{DynamicResource MahApps.Styles.ToggleButton.Circle}">
<ToggleButton.ContentTemplate>
<DataTemplate>
<iconPacks:PackIconModern Width="20"
Height="20"
Kind="City" />
</DataTemplate>
</ToggleButton.ContentTemplate>
</ToggleButton>
</StackPanel>
</StackPanel>

<StackPanel Grid.Row="0" Grid.Column="3">
Expand Down Expand Up @@ -151,9 +183,6 @@
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="BorderBrush" Value="{DynamicResource MahApps.Brushes.Accent}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray7}" />
</Trigger>
</Style.Triggers>
</Style>
</StackPanel.Resources>
Expand Down Expand Up @@ -189,6 +218,59 @@
</Button.ContentTemplate>
</Button>
</StackPanel>

<StackPanel Margin="{StaticResource ControlMargin}"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Button Width="48"
Height="48"
Margin="4"
Style="{StaticResource MahApps.Styles.Button.Circle}">
<iconPacks:PackIconModern Width="20"
Height="20"
Kind="City" />
</Button>
<Button Width="48"
Height="48"
Margin="4"
IsEnabled="False"
Style="{StaticResource MahApps.Styles.Button.Circle}">
<iconPacks:PackIconModern Width="20"
Height="20"
Kind="City" />
</Button>
</StackPanel>
<StackPanel Margin="{StaticResource ControlMargin}"
HorizontalAlignment="Center"
Orientation="Horizontal">
<Button Width="48"
Height="48"
Margin="4"
Foreground="{DynamicResource MahApps.Brushes.Accent}"
Style="{StaticResource MahApps.Styles.Button.Circle}">
<Button.ContentTemplate>
<DataTemplate>
<iconPacks:PackIconModern Width="20"
Height="20"
Kind="City" />
</DataTemplate>
</Button.ContentTemplate>
</Button>
<Button Width="48"
Height="48"
Margin="4"
Foreground="{DynamicResource MahApps.Brushes.Accent}"
IsEnabled="False"
Style="{StaticResource MahApps.Styles.Button.Circle}">
<Button.ContentTemplate>
<DataTemplate>
<iconPacks:PackIconModern Width="20"
Height="20"
Kind="City" />
</DataTemplate>
</Button.ContentTemplate>
</Button>
</StackPanel>
</StackPanel>

<StackPanel Grid.Row="1"
Expand Down
15 changes: 14 additions & 1 deletion src/MahApps.Metro/Styles/Controls.Buttons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,11 @@
</Setter.Value>
</Setter>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray7}" />
</Trigger>
</Style.Triggers>
</Style>

<!-- "Chromeless" style for buttons -->
Expand Down Expand Up @@ -653,7 +658,7 @@
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.IdealForeground}" />
<Setter TargetName="PART_ContentPresenter" Property="TextElement.Foreground" Value="{DynamicResource MahApps.Brushes.IdealForeground}" />
<Setter TargetName="ellipse" Property="Stroke" Value="{DynamicResource MahApps.Brushes.Accent}" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
Expand All @@ -671,6 +676,14 @@
</Setter.Value>
</Setter>
<Setter Property="VerticalContentAlignment" Value="Center" />
<Style.Triggers>
<Trigger Property="ToggleButton.IsChecked" Value="True">
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.IdealForeground}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource MahApps.Brushes.Gray7}" />
</Trigger>
</Style.Triggers>
</Style>

<Style x:Key="MahApps.Styles.ToggleButton" TargetType="{x:Type ToggleButton}">
Expand Down

0 comments on commit 9c721a4

Please sign in to comment.