MahApps ToggleSwitch在.Net Core 3.1的2.0版本中找不到。

问题描述 投票:0回答:1

我正在为一个wpf-mvvm netcoreapp3.1应用程序使用最新版本的MahApps.Metro。我把mvvm应用从wpf-mvvm.netframework4.7应用迁移过来。我之前的wpf-mvvm .netframework4.7应用有以下内容。

 <mahapps:ToggleSwitch  OnLabel="{Binding OnLabelText}" 
                        OffLabel="{Binding OffLabelText}"
                        CheckedCommand="{Binding StartDistributionCommand}"
                        UnCheckedCommand="{Binding StopDistributionCommand}"
                        Style="{StaticResource ToggleSwitch.Win10}"
                        IsChecked="{Binding WebDistributionOnStatus, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">

wpf .netcoreapp3.1的更新版本是:

 <mahapps:ToggleSwitch  OnContent="{Binding OnLabelText}" 
                        OffContent="{Binding OffLabelText}"
                        CheckedCommand="{Binding StartDistributionCommand}"
                        UnCheckedCommand="{Binding StopDistributionCommand}"
                        Style="{StaticResource ToggleSwitch.Win10}"
                        IsOn="{Binding WebDistributionOnStatus, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">

问题是... 检查命令未选中的命令 ToggleSwitch控件的参数已不存在,我找不到合适的替代品。任何帮助将被感激。

c# wpf-controls mahapps.metro .net-core-3.1
1个回答
0
投票

这个问题已经解决了,这要感谢 @punker76 给我添加了两个属性。MahApps.Metro 在拉请求 #3785

<Controls:ToggleSwitch CommandParameter="{Binding}"
                   OnCommand="{Binding ToggleSwitchOnCommand}"
                   OffCommand="{Binding ToggleSwitchOffCommand}" />
© www.soinside.com 2019 - 2024. All rights reserved.