Skip to content
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

CheckedCommand and UnCheckedCommand Missing in 2.0.0-Alpha0748 #3783

Closed
fradsham opened this issue Apr 28, 2020 · 3 comments · Fixed by #3785
Closed

CheckedCommand and UnCheckedCommand Missing in 2.0.0-Alpha0748 #3783

fradsham opened this issue Apr 28, 2020 · 3 comments · Fixed by #3785
Assignees
Milestone

Comments

@fradsham
Copy link

Missing Commands in the new alpha version*

Not to repeat but I asked this on stackoverflow but never got a response, so I would like to ask here because I do not know if this removal of the two commands is intentional or not? If it is intentionally removed, is there an example to develop a work around?

To Reproduce
Steps to reproduce the behavior:

  1. Create a new ToggleSwitch in and xaml file
    <mahapps:ToggleSwitch OnContent="{Binding OnLabelText}" OffContent="{Binding OffLabelText}" Style="{StaticResource ToggleSwitch.Win10}"/>
  2. The properties from version 1.65 (CheckedCommand and UnCheckedCommand) are not available in version 2.0.0-Alpha0748

Environment:

  • Nuget: MahApps.Metro version v2.0.0-Alpha0748
  • OS: Windows 10 Build 177763
  • Visual Studio 2019 v16.5.1
  • .NET Core 3.1.200
@timunie
Copy link
Collaborator

timunie commented Apr 29, 2020

Hi @fradsham ,

it seems it was replaced by just one Command. see:

/// <summary>
/// Gets or sets a command which will be executed when the <see cref="IsOnProperty"/> changes.
/// </summary>
public ICommand Command
{
get => (ICommand)this.GetValue(CommandProperty);
set => this.SetValue(CommandProperty, value);
}

I hope this helps you

Happy coding,
Tim

@fradsham
Copy link
Author

Thanks, Tim for the information.
I can re-write the command in my ViewModel but the two commands allowed me to keep the logic simple for starting and stopping a service without having track status of the UI logic in my code. It helped a lot to keep things separate.

Would there be an appetite if someone wanted to do a pull-request and add the OnCommand and OffCommand based on the Command mentioned above, so there are three options for developers?

Happy Coding
@fradsham

@punker76 punker76 self-assigned this Apr 29, 2020
@punker76 punker76 added this to the 2.0.0 milestone Apr 29, 2020
punker76 added a commit that referenced this issue Apr 29, 2020
…-Off-Commands

(GH-3783) Add OnCommand and OffCommand to ToggleSwitch
@punker76
Copy link
Member

@fradsham This will be available in next release again.

<Controls:ToggleSwitch CommandParameter="{Binding}"
                       OnCommand="{Binding ToggleSwitchOnCommand}"
                       OffCommand="{Binding ToggleSwitchOffCommand}" />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants