Materialdesigninxamltoolkit: ToggleButtons are broken

Created on 4 Apr 2016  路  12Comments  路  Source: MaterialDesignInXAML/MaterialDesignInXamlToolkit

The _MaterialDesignActionLightToggleButton_, _MaterialDesignActionToggleButton_, _MaterialDesignActionDarkCheckBox_ and _MaterialDesignActionAccentToggleButton_ styles are broken in version 1.5 and 2.0. Version 1.4.1 works as expected.

Steps to reproduce:

  • Download the source code from Github release 1.5.0 and 1.4.1.
  • Open the MaterialDesignToolkit.Wpf Solution
  • Build and start the MaterialDesignDemo project
  • Go to "Buttons & Toggles"
  • Look ;)

See attached image for comparison
materialdesign

Most helpful comment

I found the problem in the MathConverter.
I have a german system and the ConverterParameter "2.0" is parsed as 20 resulting in a Radius of 1.6 instead of 16.

Using the InvariantCulture in the TryParse call fixes this.

All 12 comments

I'm looking at this...

image

I did re-write the template for those buttons though...but can't reproduce your issue...

image

@TheSylence @mgnslndh are you guys seeing any warning being spat out in the Output window?

I think it must be something to do with the clipping starting here https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/blob/master/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ToggleButton.xaml#L107

I've tried this on two PCs and I don't have the issue.

Could you guys start replacing the bindings, one by one, with the value 32, and tell me which line(s) bring them back.

In bother the OnGrid and OffGrid there are EllipseGeometry RadiusX and RadiusY bindings, and a multi binding on EllipseGeometry.Center.

I'm thinking maybe there is a timing thing and the clip is getting generated by a zero width or something...

I get this binding error in the Output window:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'ElementName=UncheckedEllipse'. BindingExpression:Path=RenderedGeometry; DataItem=null; target element is 'Grid' (Name=''); target property is 'Clip' (type 'Geometry')

Probably because of this line:

https://github.com/ButchersBoy/MaterialDesignInXamlToolkit/blob/master/MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ToggleButton.xaml#L47

But I can not find any control named UncheckedEllipse

What happens if you remove that Clip property?

Removing that binding does not seem to affect anything.
Changing RadiusX and RadiusY to 32 does indeed show the ToggleButton but of course, not looking like it should. For both OffGrid and OnGrid.

Yep same here.
I have the same Binding Error in the Output Window and changing the Radius properties to 32 brings back the content (although not as an ellipse but rather as an rectangle, but I guess I would have to tweak the values to get the ellipse back)

OK...I'll try and get on some other PCs and see if I can reproduce...I wonder if .Net fx versions could affect it...know what exact versions you are running?

I found the problem in the MathConverter.
I have a german system and the ConverterParameter "2.0" is parsed as 20 resulting in a Radius of 1.6 instead of 16.

Using the InvariantCulture in the TryParse call fixes this.

Excellent! Can your raise a PR?

@TheSylence thank you, and welcome to the contributors list

Was this page helpful?
0 / 5 - 0 ratings

Related issues

StephanBis picture StephanBis  路  16Comments

darturdotnetdeveloper picture darturdotnetdeveloper  路  11Comments

olegsavelos picture olegsavelos  路  11Comments

ttweixiao9999 picture ttweixiao9999  路  14Comments

shunjid picture shunjid  路  23Comments