Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

jizc
Copy link
Contributor

@jizc jizc commented Jun 19, 2022

Part of issue #2475

This PR adds a Material Design 3 version of the MaterialDesignSwitchToggleButton style.

Md3Switch
Md3Switch

Specs

https://m3.material.io/components/switch/specs

Notes

  • The other styles in the MaterialDesign3.ToggleButton.xaml resource dictionary are just copies of the ones in MaterialDesignTheme.ToggleButton.xaml
  • The colors don't match the specs exactly. This is the closest I could come with the current color system. We should give it another pass when/if a more complete MD3 color system is implemented.

@Keboo Keboo added this to the 4.6.0 milestone Jun 20, 2022
@Keboo Keboo self-requested a review June 20, 2022 19:51
@Keboo Keboo added enhancement release notes Items are likely to be highlighted in the release notes. labels Jun 20, 2022
Copy link
Member

@Keboo Keboo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work thank you!

@Keboo Keboo merged commit e482d0b into MaterialDesignInXAML:master Jun 21, 2022
@jizc jizc deleted the feature/md3-switch-style branch June 21, 2022 09:06
@soghomonyansargis
Copy link

soghomonyansargis commented Aug 31, 2022

Hi, I am getting IOException: Cannot locate resource exception when trying to use this`
"ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.ToggleButton.xaml"

(Cannot locate resource 'themes/materialdesign3.togglebutton.xaml'.)

@jizc
Copy link
Contributor Author

jizc commented Aug 31, 2022

@soghomonyansargis It hasn't been released yet. Look for it in the upcoming 4.6.0 release.

@Nextra
Copy link
Contributor

Nextra commented Sep 23, 2022

These look fantastic, but they are absolutely massive compared to the MD2 variant. The box size is pretty much double, and without the borders the MD2 variant feels much smaller visually on top of that.

How difficult would it be to have a separate style that more closely matches the MD2 size, or even make this one adjustable? Simply changing the height breaks the styling of the MD3 variant unfortunately.

@oszoou
Copy link

oszoou commented Mar 6, 2024

Indeed, they are massive. Here is a temporary solution.

<ToggleButton Style="{StaticResource MaterialDesignSwitchToggleButton}">
    <ToggleButton.RenderTransform>
        <ScaleTransform CenterX="0" CenterY="0" ScaleX="0.8" ScaleY="0.8" />
    </ToggleButton.RenderTransform>
</ToggleButton>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement release notes Items are likely to be highlighted in the release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants