-
-
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
ToggleSwitchButton rewrite #1652
Conversation
The 'Stop animation on interaction' is a little fix that ensures that the thumb animation is stopped when the user starts interacting with the ToggleSwitchButton. In the old situation the animation would continue while the user was already dragging the thumb again and the thumb would make a little 'jump' when the animation completed. Now the animation stops immediately and everything is smooth. |
@Dotnetifier first, it looks nice, second, if i double click on the thumb i get a strange behavior by moving the mouse... |
Wow. I can seriously not believe I missed that. Fixed it now, though. |
Looks good, thanks @Dotnetifier! |
</Border> | ||
</Grid> | ||
</Border> | ||
<Rectangle x:Name="PART_ThumbIndicator" Fill="Black" Width="13" HorizontalAlignment="Left"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed a bit too late, that this is hardcoded to black and won't play well with the dark theme
@flagbug Should I commit to this branch? If so, what will happen (new PR, etc.)? |
@Dotnetifier i saw this on output too
you should make a new pr for your new changes |
@Dotnetifier no, open a new one On 20:35, Thu, Nov 20, 2014 Jan Karger notifications@github.com wrote:
|
Hi, I was able to successfully create a copy of the style for the previous ToggleSwitchButton and edit it to change colours etc. When I try creating a copy of the style for the new ToggleSwitchButton and set the style of the control to point to that instead (bearing in mind this is an exact copy of the style) then the button no longer works in the running app. The mouse-over successfully changes the grey of the control to be a bit darker but there is no 'click' at all and you cannot turn the ToggleSwitch on.
|
@InsaneSquirrel What release of MahApps.Metro are you using? This style could never apply to any older version of the ToggleSwitchButton, because redundant elements have been removed and other elements have been renamed. I was able to confirm your issue while using an older build of MahApps.Metro. Then I referenced to an assembly built a few minutes from the source code, which gave me the correct behavior. |
@Dotnetifier Thanks for the fast response. I am using the 1.0.0.0 build. I updated MahApps to the latest NuGet package and then added a
to a user control I have built. I then right-clicked the control and chose 'Edit Template' > 'Edit a Copy' and added the copied style to my Resource Dictionary (this is the code supplied above).
As soon as I do this and then run the application (without making any changes to the style) the ToggleSwitchButton doesn't function as mentioned. Control displays and the grey changes on mouse-over but no click or drag functions. As soon as I edit the XAML and remove the style the control functions again as normal. Thanks |
@Dotnetifier I have just built a blank new WPF application with MahApps to test and the same issue is occurring with the control on the MainWindow.xaml. I then updated MahApps to 1.0.1-ALPHA001 Prerelease and the same issue is still apparent. Added a 'Checked' handler to the control to test
If you click the control the message never gets fired so it looks like an issue with the control actually trying to enter a checked state. |
The changes I made have not yet appeared in any stable release of MahApps.Metro, so this new style does not apply for v1.0.0.0. If you want to write a custom style, you need to modify the one from the package before this commit and create a new style after updating MA.M, or you will have to use an unstable release or a build directly from the source code for now. |
They are in 1.0.0 |
Oops, my bad. Didn't know v1.0.0 is stable now. I'll look into this when I get home, maybe a few hours or so. |
so, first there is a difference between
and second, you are right if a create a custom style, there is no more click action. the thus, it is an issue of Blend... |
@Dotnetifier Ahhh, so it's ripping out a much-needed part of the template which is where the issue is. Thanks for looking into this, I will try and re-embed the missing parts of the template to see if this resolves the issue. Thanks again. |
@Dotnetifier Works a treat after adding the following back in
Once again thanks for pointing that out. Hate when bugs get in the way of simple things : ) |
@InsaneSquirrel @Dotnetifier No problem, I like to help. :-D |
@punker76 Apologies, didn't notice the change of name on that update. I would like to express my thanks to you : ) |
@punker76 @InsaneSquirrel Yes, thanks! I probably would have been debugging this thing for an hour only to find out that name does not get copied... |
Well... most of the
ToggleSwitchButton
code has been rewritten. The animation of the thumb now resides in the code behind since the size of the button might change, as described in an issue (see below). The control now mimics the button of the ToggleSwitch found in the Windows Store apps, including the drag over the entire button-feature.Fixes #1595 and #1466.