WPFNativeThemeToggleControl 1.0.22

dotnet add package WPFNativeThemeToggleControl --version 1.0.22
                    
NuGet\Install-Package WPFNativeThemeToggleControl -Version 1.0.22
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WPFNativeThemeToggleControl" Version="1.0.22" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WPFNativeThemeToggleControl" Version="1.0.22" />
                    
Directory.Packages.props
<PackageReference Include="WPFNativeThemeToggleControl" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WPFNativeThemeToggleControl --version 1.0.22
                    
#r "nuget: WPFNativeThemeToggleControl, 1.0.22"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WPFNativeThemeToggleControl@1.0.22
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WPFNativeThemeToggleControl&version=1.0.22
                    
Install as a Cake Addin
#tool nuget:?package=WPFNativeThemeToggleControl&version=1.0.22
                    
Install as a Cake Tool

WPFNativeThemeToggleControl

Build WPFNativeThemeToggleControl

Native-feeling WPF theme toggle button for .NET 10 apps. It supports Light, Dark, and optional System mode, and updates Application.Current.ThemeMode when toggled. Best used with themes like the WPF 9+ built in fluent theme.

Features

  • Small icon-only ThemeToggleControl
  • TriMode support (System -> Dark -> Light cycle)
  • Two-mode support (Light <-> Dark)
  • One or Two Way Binding to properties
  • ThemeChanged routed event with old/new values

Install

dotnet add package WPFNativeThemeToggleControl

Quick start

Add the XML namespace:

xmlns:ThemeToggle="clr-namespace:WPFNativeThemeToggleControl;assembly=WPFNativeThemeToggleControl"

Use the control:

<ThemeToggle:ThemeToggleControl
    TriMode="True" CurrentTheme="{Binding OurThemeProp, Mode=TwoWay}"
    ThemeChanged="ThemeToggle_ThemeChanged" />

When not using data binding, there are two ways to set the initial theme in XAML.

Option 1: CurrentTheme with ThemeMode (strongly typed)

Add the sw namespace to your XAML root:

xmlns:sw="clr-namespace:System.Windows;assembly=PresentationFramework"

Then use x:Static:

<ThemeToggle:ThemeToggleControl
    CurrentTheme="{x:Static sw:ThemeMode.Dark}"
    ThemeChanged="ThemeToggle_ThemeChanged" />

Option 2: CurrentThemeStr with a string

<ThemeToggle:ThemeToggleControl
    CurrentThemeStr="DarkMode"
    ThemeChanged="ThemeToggle_ThemeChanged" />

Accepted string values include Light, Dark, System, and forms like DarkMode.

Handle theme changes (optional):

using WPFNativeThemeToggleControl;

private void ThemeToggle_ThemeChanged(object sender, ThemeChangedEventArgs e)
{
    Title = $"Theme: {e.NewTheme}";
}

Advanced usage

If your app needs custom theme application behavior, override ThemeChangeApplyAction:

ThemeToggle.ThemeChangeApplyAction = newTheme =>
{
    // Your custom theme apply logic
    Application.Current!.ThemeMode = newTheme;
};

Because WPF theme mode control support is still experimental in .NET 9/10, your project may need:

<NoWarn>$(NoWarn);WPF0001</NoWarn>
Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.22 37 3/11/2026