-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
(GH-3349) Fix disable content of ToggleButton & Button when using circle style #3610
Conversation
Hi @mgnslndh for other controls MahApps uses an opaque overlay over the button /control. I don't have a PC right now but I think I saw it at the Happy coding |
@timunie thanks for the feedback! This was just a quick fix using the same solution as found on other button styles: MahApps.Metro/src/MahApps.Metro/Styles/Controls.Buttons.xaml Lines 63 to 65 in e59402c
MahApps.Metro/src/MahApps.Metro/Styles/Controls.Buttons.xaml Lines 141 to 143 in e59402c
MahApps.Metro/src/MahApps.Metro/Styles/Controls.Buttons.xaml Lines 249 to 251 in e59402c
I'm not aware of an easy way of doing an overlay of an elliptical control with transparent background. Using an overlay like for the default button style probably works well because it is rectangular and the whole content area is covered by the disabled state. MahApps.Metro/src/MahApps.Metro/Styles/Controls.Buttons.xaml Lines 412 to 417 in e59402c
Not sure that is how the circle variant is supposed to look. Disabled state covering the whole circle. This is the expected result from the original issue: Do you have any suggestions? |
@mgnslndh your changes have been merged, thanks for your contribution 👍 I added 2 more samples to the demo which shows the workaround for disabled Buttons with custom Foreground (and respect the changes from GH-3121, GH-3101). <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 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> |
Nice @punker76! Moving to 2.0.0 release one issue at a time :) |
Hello @mgnslndh , just for information you can find my first idea below:
I have to agree that your and @punker76 's solution looks much nicer! Thank you 👍 Happy coding |
Describe the changes you have made to improve this project
Foreground
property toMahApps.Styles.ToggleButton.Circle
whenIsEnabled=False
Foreground
property toMahApps.Styles.Button.Circle
whenIsEnabled=False
MahApps.Styles.Button.Circle
(current demo only display a custom derived style for Accent color)Closed Issues
Closes #3349