重要前提
安装AI Skills的关键前提是:必须科学上网,且开启TUN模式,这一点至关重要,直接决定安装能否顺利完成,在此郑重提醒三遍:科学上网,科学上网,科学上网。查看完整安装教程 →
avalonia by markpitt/claude-skills
npx skills add https://github.com/markpitt/claude-skills --skill avalonia使用 Avalonia 进行跨平台桌面和移动开发的模块化指南,Avalonia 是一个受 WPF 启发的、基于 XAML 的 .NET 框架。
| 任务/目标 | 加载资源 |
|---|---|
| MVVM 模式、数据绑定、依赖注入、值转换器 | resources/mvvm-databinding.md |
| UI 控件参考(布局、输入、集合、菜单) | resources/controls-reference.md |
| 自定义控件、高级布局、性能优化、虚拟化 | resources/custom-controls-advanced.md |
| 样式、主题、动画、控件模板 | resources/styling-guide.md |
| 响应式模式、命令、可观察对象、动画 | resources/reactive-animations.md |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| Windows、macOS、Linux、iOS、Android 实现细节 | resources/platform-specific.md |
Avalonia 是一个支持以下功能的跨平台 XAML 框架:
MyAvaloniaApp/
├── MyAvaloniaApp/ # 共享代码
│ ├── App.axaml
│ ├── Views/ # XAML 视图
│ ├── ViewModels/ # 业务逻辑 + 状态
│ ├── Models/ # 数据模型
│ ├── Services/ # 应用程序服务
│ ├── Converters/ # 值转换器
│ ├── Assets/ # 图像、字体
│ └── Styles/ # 样式资源
├── MyAvaloniaApp.Desktop/ # 桌面端特定(Win/Mac/Linux)
├── MyAvaloniaApp.Android/ # Android 特定(可选)
├── MyAvaloniaApp.iOS/ # iOS 特定(可选)
└── MyAvaloniaApp.Browser/ # WebAssembly(可选)
// Program.cs
public static void Main(string[] args)
{
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
<!-- App.axaml -->
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MyApp.App">
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>
<!-- Views/MainWindow.axaml -->
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MyApp.Views.MainWindow"
Title="My Application"
Width="800"
Height="600">
<StackPanel Padding="20" Spacing="10">
<TextBlock Text="Hello, Avalonia!" FontSize="24" FontWeight="Bold" />
</StackPanel>
</Window>
加载 resources/mvvm-databinding.md 以获取:
利用 ReactiveUI 实现事件驱动的 UI 更新:
this.WhenAnyValue(x => x.SearchText)
.Debounce(TimeSpan.FromMilliseconds(300))
.Subscribe(text => PerformSearch(text));
加载 resources/reactive-animations.md 以获取:
一次设计,适应多平台:
<OnPlatform Default="16">
<On Options="Windows" Content="14" />
<On Options="macOS" Content="15" />
</OnPlatform>
加载 resources/platform-specific.md 以获取:
resources/mvvm-databinding.md → 实现带属性验证的 ViewModelresources/controls-reference.md → 查找 TextBox、ComboBox、Button 控件resources/reactive-animations.md → 使用可观察对象添加防抖验证resources/custom-controls-advanced.md → 启用虚拟化resources/mvvm-databinding.md → 使用编译绑定resources/reactive-animations.md → 防抖/节流更新resources/platform-specific.md → 实现服务接口resources/mvvm-databinding.md → 通过 DI 注册平台实现resources/ → 实现每个平台的项目resources/styling-guide.md → 定义样式和主题resources/reactive-animations.md → 向样式添加动画resources/custom-controls-advanced.md → 自定义控件模板resources/custom-controls-advanced.md → TemplatedControl 或 UserControl 模式resources/mvvm-databinding.md → 附加属性和数据绑定resources/styling-guide.md → 控件模板和样式mvvm-databinding.md (主要)controls-reference.md (主要)styling-guide.md (主要)reactive-animations.md (高级)custom-controls-advanced.md (高级)platform-specific.md (高级)1. → 设置:标准项目结构 + FluentTheme
2. → 遵循 MVVM 创建 Views 和 ViewModels
3. → 使用 controls-reference 进行 UI 布局
4. → 使用 styling-guide 添加样式
5. → 使用 DI 实现服务(mvvm-databinding)
6. → 使用 reactive-animations 添加动画
7. → 使用 platform-specific 指南在每个平台上测试
1. → 创建共享项目 + 平台特定项目
2. → 在共享代码中定义服务接口(mvvm-databinding)
3. → 为每个平台实现服务(platform-specific)
4. → 使用 OnPlatform 实现自适应 UI
5. → 通过 DI 注册平台实现
6. → 在每个目标平台(iOS/Android/Windows/Mac)上彻底测试
1. → 创建 SearchViewModel(mvvm-databinding)
2. → 为结果使用 ObservableCollection(mvvm-databinding)
3. → 使用响应式搜索模式实现(reactive-animations)
4. → 防抖输入以减少 API 调用
5. → 使用 ListBox 显示(controls-reference)
6. → 使用适当的 CSS 选择器进行样式设置(styling-guide)
1. → 设计 ViewModel 层次结构(mvvm-databinding)
2. → 创建主从视图(mvvm-databinding)
3. → 为表格数据使用 DataGrid(controls-reference)
4. → 使用可观察对象添加排序/过滤(reactive-animations)
5. → 使用虚拟化进行优化(custom-controls-advanced)
6. → 如果需要,添加自定义控件(custom-controls-advanced)
架构
性能
x:DataType 启用编译绑定样式
响应式模式
测试
有关平台特定的构建和部署指南,请参阅 resources/platform-specific.md。
导航 : 根据您的任务从上方选择一个资源。每个资源都包含全面的示例和最佳实践,自成一体。
每周安装次数
61
仓库
GitHub 星标数
12
首次出现
2026年1月24日
安全审计
安装于
gemini-cli54
opencode54
github-copilot54
cursor51
codex51
kimi-cli47
Modular guidance for cross-platform desktop and mobile development using Avalonia, a WPF-inspired XAML-based framework for .NET.
| Task/Goal | Load Resource |
|---|---|
| MVVM patterns, data binding, dependency injection, value converters | resources/mvvm-databinding.md |
| UI controls reference (layouts, inputs, collections, menus) | resources/controls-reference.md |
| Custom controls, advanced layouts, performance optimization, virtualization | resources/custom-controls-advanced.md |
| Styling, themes, animations, control templates | resources/styling-guide.md |
| Reactive patterns, commands, observables, animations | resources/reactive-animations.md |
| Windows, macOS, Linux, iOS, Android implementation details | resources/platform-specific.md |
Avalonia is a cross-platform XAML framework supporting:
MyAvaloniaApp/
├── MyAvaloniaApp/ # Shared code
│ ├── App.axaml
│ ├── Views/ # XAML views
│ ├── ViewModels/ # Business logic + state
│ ├── Models/ # Data models
│ ├── Services/ # Application services
│ ├── Converters/ # Value converters
│ ├── Assets/ # Images, fonts
│ └── Styles/ # Style resources
├── MyAvaloniaApp.Desktop/ # Desktop-specific (Win/Mac/Linux)
├── MyAvaloniaApp.Android/ # Android-specific (optional)
├── MyAvaloniaApp.iOS/ # iOS-specific (optional)
└── MyAvaloniaApp.Browser/ # WebAssembly (optional)
// Program.cs
public static void Main(string[] args)
{
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
public static AppBuilder BuildAvaloniaApp() =>
AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
<!-- App.axaml -->
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MyApp.App">
<Application.Styles>
<FluentTheme />
</Application.Styles>
</Application>
<!-- Views/MainWindow.axaml -->
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="MyApp.Views.MainWindow"
Title="My Application"
Width="800"
Height="600">
<StackPanel Padding="20" Spacing="10">
<TextBlock Text="Hello, Avalonia!" FontSize="24" FontWeight="Bold" />
</StackPanel>
</Window>
Load resources/mvvm-databinding.md for:
Leverage ReactiveUI for event-driven UI updates:
this.WhenAnyValue(x => x.SearchText)
.Debounce(TimeSpan.FromMilliseconds(300))
.Subscribe(text => PerformSearch(text));
Load resources/reactive-animations.md for:
Design once, adapt per platform:
<OnPlatform Default="16">
<On Options="Windows" Content="14" />
<On Options="macOS" Content="15" />
</OnPlatform>
Load resources/platform-specific.md for:
resources/mvvm-databinding.md → Implement ViewModel with property validationresources/controls-reference.md → Find TextBox, ComboBox, Button controlsresources/reactive-animations.md → Add debounced validation with observablesresources/custom-controls-advanced.md → Enable virtualizationresources/mvvm-databinding.md → Use compiled bindingsresources/reactive-animations.md → Debounce/throttle updatesresources/platform-specific.md → Implement service interfacesresources/mvvm-databinding.md → Register platform implementations via DIresources/ → Implement per-platform projectresources/styling-guide.md → Define styles and themesresources/reactive-animations.md → Add animations to stylesresources/custom-controls-advanced.md → Custom control templatesresources/custom-controls-advanced.md → TemplatedControl or UserControl patternresources/mvvm-databinding.md → Attached properties and data bindingresources/styling-guide.md → Control templates and stylingmvvm-databinding.md (Primary)controls-reference.md (Primary)styling-guide.md (Primary)reactive-animations.md (Advanced)custom-controls-advanced.md (Advanced)platform-specific.md (Advanced)1. → Setup: Standard project structure + FluentTheme
2. → Create Views and ViewModels following MVVM
3. → Use controls-reference for UI layouts
4. → Add styles with styling-guide
5. → Implement services with DI (mvvm-databinding)
6. → Add animations with reactive-animations
7. → Test on each platform with platform-specific guidance
1. → Create shared project + platform-specific projects
2. → Define service interfaces in shared code (mvvm-databinding)
3. → Implement services per platform (platform-specific)
4. → Use OnPlatform for adaptive UI
5. → Register platform implementations via DI
6. → Test thoroughly on each target (iOS/Android/Windows/Mac)
1. → Create SearchViewModel (mvvm-databinding)
2. → Use ObservableCollection for results (mvvm-databinding)
3. → Implement with reactive search pattern (reactive-animations)
4. → Debounce input to reduce API calls
5. → Display with ListBox (controls-reference)
6. → Style with appropriate CSS selectors (styling-guide)
1. → Design ViewModel hierarchy (mvvm-databinding)
2. → Create master-detail view (mvvm-databinding)
3. → Use DataGrid for tabular data (controls-reference)
4. → Add sorting/filtering with observables (reactive-animations)
5. → Optimize with virtualization (custom-controls-advanced)
6. → Add custom controls if needed (custom-controls-advanced)
Architecture
Performance
x:DataTypeStyling
Reactive Patterns
Testing
Refer to resources/platform-specific.md for platform-specific build and deployment guidance.
Navigation : Choose a resource above based on your task. Each resource is self-contained with comprehensive examples and best practices.
Weekly Installs
61
Repository
GitHub Stars
12
First Seen
Jan 24, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
gemini-cli54
opencode54
github-copilot54
cursor51
codex51
kimi-cli47
.NET和Python后端全局错误处理配置指南:异常中间件与自定义异常
221 周安装