Leaf.Controls 1.0.5

dotnet add package Leaf.Controls --version 1.0.5
                    
NuGet\Install-Package Leaf.Controls -Version 1.0.5
                    
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="Leaf.Controls" Version="1.0.5" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Leaf.Controls" Version="1.0.5" />
                    
Directory.Packages.props
<PackageReference Include="Leaf.Controls" />
                    
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 Leaf.Controls --version 1.0.5
                    
#r "nuget: Leaf.Controls, 1.0.5"
                    
#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 Leaf.Controls@1.0.5
                    
#: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=Leaf.Controls&version=1.0.5
                    
Install as a Cake Addin
#tool nuget:?package=Leaf.Controls&version=1.0.5
                    
Install as a Cake Tool

Leaf.Controls

一个面向 .NET 8 的现代化 WPF 控件库,旨在通过提供一系列自定义控件、附加属性和实用工具来简化 UI 开发。

功能特性

Leaf.Controls 提供了多种 UI 组件和辅助类:

控件 (Controls)

  • LeafWindow: 支持现代样式的自定义窗口。
  • LeafMessageBox: 增强型消息框,提供更好的用户交互。
  • LeafToast: 非侵入式的 Toast 通知。
  • TitleBar: 配合 TitleBarButton 使用的可自定义标题栏。
  • NumberBox: 针对数值输入优化的输入控件。
  • DateTimePicker: 多功能的日期和时间选择器。
  • ToggleLabel: 可切换的标签控件。
  • SimplePanel: 轻量级的面板容器。
  • ImageViewer / WrapImageViewer: 用于显示和管理图像的控件,支持 ROI 形状。

附加属性 (Attach Properties)

  • Attach: 针对 DataGridTextBoxCheckBoxBorder (BorderElement) 和 IconElement 的扩展,增加了额外的功能和样式能力。

实用工具 (Utilities)

  • ThemeManager: 管理应用程序主题的帮助类。
  • Converters: 全面的值转换器集合(例如 BooleanToVisibilityConverter, EnumDescriptionConverter, ThicknessSplitConverter)。
  • Commands: 用于 MVVM 模式的 RelayCommand 实现。

安装

您可以在项目中引用 Leaf.Controls 库。

(如果已发布到 NuGet)

<PackageReference Include="Leaf.Controls" Version="1.0.2" />

使用方法

  1. 修改 App.xaml,引入资源字典:
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>
            <ResourceDictionary Source="pack://application:,,,/Leaf.Controls;component/Themes/ThemesColors/ColorLight.xaml" />
            <ResourceDictionary Source="pack://application:,,,/Leaf.Controls;component/Themes/Leaf.Ui.xaml" />
        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>
  1. 在 XAML 中引入命名空间:
xmlns:leaf="http://schemas.Leaf.Controls.com"
  1. 使用控件示例:
<leaf:LeafWindow x:Class="MyApp.MainWindow"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:leaf="http://schemas.Leaf.Controls.com"
                 Title="My Application">
    <Grid>
        <leaf:NumberBox Value="100" />
    </Grid>
</leaf:LeafWindow>

许可证 (License)

本项目采用 MIT 许可证 - 详情请参阅 LICENSE 文件。

Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.5 85 5/15/2026
1.0.3 91 5/4/2026
1.0.2 129 1/31/2026