Jeff
Jeff

Reputation: 2071

MahApps ToggleSwitch properties not found in version 2.0 in .Net Core 3.1

I create a new .Net Core 3.1 WPF application. I add nuget package for MahApps.Metro v 2.0.0-alpha0748

I this add a toggleswitch to the 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>

This is my 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>

The IsChecked is marked as not found in type ToggleSwitch.

Other properties as well are not found... OffLabel, OnLabel, IsCheckedChanged, ...

Am I missing a dependency?

TIA

Upvotes: 2

Views: 1325

Answers (1)

mm8
mm8

Reputation: 169228

The property is called IsOn in 2.0.0-alpha0748.

OffLabel and OnLabel is OffContent and OnContent respectively and IsCheckedChanged is Toggled.

Upvotes: 5

Related Questions