wpf - 在 .Net Core 3.1 的 2.0 版中找不到 MahApps ToggleSwitch 属性
问题描述
我创建了一个新的 .Net Core 3.1 WPF 应用程序。我为 MahApps.Metro v 2.0.0-alpha0748 添加了 nuget 包
我向 xaml 添加了一个切换开关
<Window x:Class="WpfTestSandbox.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfTestSandbox"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<mah:ToggleSwitch Header="WiFi rest state"
Ischecked="True" />
</Grid>
</Window>
这是我的 App.xaml
<Application x:Class="WpfTestSandbox.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfTestSandbox"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
<!-- Accent and AppTheme setting -->
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/dark.green.xaml" />
<ResourceDictionary>
<SolidColorBrush x:Key="{x:Static SystemColors.WindowTextBrushKey}" Color="White"/>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
IsChecked 在类型 ToggleSwitch 中被标记为未找到。
也找不到其他属性... OffLabel、OnLabel、IsCheckedChanged、...
我是否缺少依赖项?
TIA
解决方案
该属性在 中IsOn
调用2.0.0-alpha0748
。
OffLabel
和OnLabel
是OffContent
和OnContent
分别IsCheckedChanged
是和Toggled
。
推荐阅读
- html - bootstrap 4模板文本格式问题
- python - 使用 wavelink 库对歌曲进行排队的最佳方法是什么?
- performance - 请求“等待”时间很长。您是否看到此 HTTP2.0 标头有任何问题?
- python - 获取边界框opencv的上中心
- python - 使用 PyPy 或 Cython 使用 fsolve 加速循环?
- javascript - 使用 ng-repeat 建表
- c++ - 共享指针不明确的调用/未定义的调用引用
- html - 移动滚动不适用于移动设备
- jquery - Django如何使用下拉菜单过滤表?
- python - 如何在 MDBottomNavigation 的底部导航项之间插入线条?