IceTea.Maui.Core
1.1.4
dotnet add package IceTea.Maui.Core --version 1.1.4
NuGet\Install-Package IceTea.Maui.Core -Version 1.1.4
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="IceTea.Maui.Core" Version="1.1.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IceTea.Maui.Core" Version="1.1.4" />
<PackageReference Include="IceTea.Maui.Core" />
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 IceTea.Maui.Core --version 1.1.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: IceTea.Maui.Core, 1.1.4"
#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 IceTea.Maui.Core@1.1.4
#: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=IceTea.Maui.Core&version=1.1.4
#tool nuget:?package=IceTea.Maui.Core&version=1.1.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
IceTea.Maui.Core (.NET MAUI 核心组件库)
简介
IceTea.Maui.Core 是专为 .NET MAUI 框架设计的核心组件库,提供了附加属性、值转换器、样式资源和配置管理工具。该库旨在简化 MAUI 应用开发,提供一致的 UI 体验和高效的开发模式,特别集成了 Prism 框架的支持。
安装
dotnet add package IceTea.Maui.Core
核心功能模块
一、附加属性系统
MyAttachProperty - 自定义附加属性集合
提供一系列常用的附加属性,特别针对 MAUI 和 Prism 框架进行了优化。
核心附加属性:
IsAutowire- 自动绑定 ViewModel 属性(基于 Prism 框架)
特性:
- 集成 Prism.Mvvm 的 ViewModel 自动绑定功能
- 支持 OneTime 绑定模式
- 简化 MVVM 模式的实现
使用方式:
<ContentPage xmlns:attach="clr-namespace:IceTea.Maui.Core.Attaches"
attach:MyAttachProperty.IsAutowire="True">
</ContentPage>
二、值转换器
OppositeBoolConverter - 布尔值反转转换器
将布尔值进行逻辑取反操作,适用于各种绑定场景。
使用示例:
<Label Text="{Binding IsVisible,
Converter={StaticResource OppositeBoolConverter}}" />
var converter = new OppositeBoolConverter();
bool result = (bool)converter.Convert(true, typeof(bool), null, CultureInfo.CurrentCulture);
// result = false
三、事件系统
DialogMessageEvent - 对话框消息事件
用于在 MAUI 应用程序中传递对话框相关的消息事件。
四、资源字典
样式资源
提供预定义的样式和主题资源:
主要资源文件:
ButtonDictionary.xaml- 按钮样式定义CustomColors.xaml- 自定义颜色资源ButtonDictionary.xaml.cs- 按钮字典的代码隐藏
使用方式:
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/ButtonDictionary.xaml"/>
<ResourceDictionary Source="Resources/CustomColors.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
五、配置工具
Configs目录 - 配置管理工具
提供 MAUI 应用的配置管理功能,支持 JSON 和其他格式的配置文件处理。
使用指南
1. 应用程序级资源引入
在 App.xaml 中引入核心资源:
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="YourApp.App">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resources/ButtonDictionary.xaml"/>
<ResourceDictionary Source="Resources/CustomColors.xaml"/>
</ResourceDictionary.MergedDictionaries>
<converters:OppositeBoolConverter x:Key="OppositeBoolConverter"/>
</ResourceDictionary>
</Application.Resources>
</Application>
2. 启用Prism自动绑定
在页面中启用 ViewModel 自动绑定:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:attach="clr-namespace:IceTea.Maui.Core.Attaches"
x:Class="YourApp.Views.MainPage"
attach:MyAttachProperty.IsAutowire="True"
Title="Main Page">
<StackLayout>
<Label Text="{Binding WelcomeText}" />
<Button Text="Click Me" Command="{Binding ClickCommand}" />
</StackLayout>
</ContentPage>
3. 转换器使用
在数据绑定中使用转换器:
<ContentPage.Resources>
<converters:OppositeBoolConverter x:Key="OppositeBoolConverter"/>
</ContentPage.Resources>
<Label Text="隐藏状态"
IsVisible="{Binding IsShow,
Converter={StaticResource OppositeBoolConverter}}"/>
核心特性
- Prism集成:深度集成 Prism 框架,简化 MVVM 实现
- 自动绑定:通过附加属性实现 ViewModel 自动绑定
- 一致性UI:提供统一的控件样式和用户体验
- 跨平台支持:完全兼容 .NET MAUI 的所有目标平台
- 轻量级设计:最小化依赖,最大化性能
- 现代化架构:遵循现代移动应用开发最佳实践
典型应用场景
- 企业移动应用:提供专业的移动端UI组件
- 跨平台应用:一套代码,多平台部署(iOS、Android、Windows、macOS)
- MVVM应用:结合 Prism 框架实现清晰的架构分离
- 快速原型开发:利用预定义样式快速构建应用界面
依赖说明
- .NET MAUI:核心移动应用框架
- Prism.Maui:MVVM框架支持
- Microsoft.Maui.Controls:MAUI控件库
兼容性
- .NET: 6.0+
- MAUI: 7.0+
- 平台: iOS 11+, Android 5.0+, Windows 10+, macOS 10.15+
许可证
MIT License
作者
WuMing
贡献
欢迎提交 Issue 和 Pull Request!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos 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.
-
net10.0
- IceTea.Atom (>= 1.4.9)
- Microsoft.Maui.Controls (>= 10.0.20)
- Microsoft.Maui.Controls.Compatibility (>= 10.0.20)
- Prism.Core (>= 8.1.97)
-
net8.0
- IceTea.Atom (>= 1.4.9)
- Microsoft.Maui.Controls (>= 8.0.100)
- Microsoft.Maui.Controls.Compatibility (>= 8.0.100)
- Prism.Core (>= 8.1.97)
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.1.4 | 106 | 7/31/2026 |
| 1.1.3 | 95 | 7/30/2026 |
| 1.1.2 | 101 | 7/12/2026 |
| 1.1.1 | 102 | 7/12/2026 |
| 1.1.0 | 113 | 6/11/2026 |
| 1.0.8 | 306 | 8/25/2025 |
| 1.0.7 | 140 | 8/23/2025 |
| 1.0.6 | 179 | 3/1/2025 |
| 1.0.5 | 181 | 12/20/2024 |
| 1.0.4 | 193 | 11/13/2024 |
| 1.0.3 | 185 | 11/13/2024 |
| 1.0.2 | 209 | 9/3/2024 |
| 1.0.1 | 203 | 8/11/2024 |
| 1.0.0 | 196 | 8/11/2024 |