feat(skills): add HandyControl WPF component skills
Build / build (push) Canceled after 0s

This commit is contained in:
chfei committed 2026-10-27 09:12:40 +08:00
1 parent 72d9b295a0
commit 5d81c475c8
335 files changed
+7359

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
---
name: handycontrol-wpf-shield
description: "实现、配置或排查 HandyControl WPF 的 Shield 徽章(Shield)。适用于该扩展控件的 XAML、绑定、事件和模板;不用于 Avalonia 或其他厂商控件。"
---
# HandyControl WPF Shield 徽章
实现或排查 **Shield 徽章**。相关类型:`Shield`。
## 接入
程序集/NuGet 为 `HandyControl`,XAML 命名空间为
`xmlns:hc="https://handyorg.github.io/handycontrol"`,C# 控件命名空间为 `HandyControl.Controls`。
在 `App.xaml` 合并 `pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml`,
然后合并 `pack://application:,,,/HandyControl;component/Themes/Theme.xaml`。
已有主题配置时先检查,避免重复合并。版本和目标框架以使用方项目为准。
## 实现
先读 [API 声明与继承关系](references/api.md),再按需求查看
[文档、样式与示例导航](references/usage.md)。源码路径相对于 HandyControl 仓库根目录;
在本仓库优先读本地文件,安装到其他项目后使用内附声明与链接,遇到版本差异检查实际引用版本的源码。
不要将 Demo 的 langs、ex:Lang、ViewModelLocator 或示例资源直接复制进使用方项目。
结合基类确认内容模型、绑定属性和事件参数;集合控件区分 ItemsSource、选中项与 ItemTemplate;修改样式前核对资源键和模板部件。
用目标项目现有的 MVVM 方式绑定;需要回写时明确 TwoWay 和更新时机,
不要假定所有依赖属性默认双向绑定。原生 WPF 与 HandyControl 同名类型使用命名空间区分。
交付时运行目标框架的构建,并在窗口加载后检查模板、绑定错误、空值和相关输入边界;
无法运行 WPF 时明确说明尚未验证 UI 行为。
## 最小片段
依赖上面的应用资源配置;Binding 路径由使用方 ViewModel 提供。
```xml
<StackPanel Orientation="Horizontal" Margin="32">
<hc:Shield Subject=".net" Status=">=4.0" Color="#1182c3"/>
<hc:Shield Subject="c#" Status="7.0" Margin="4,0,0,0" Color="#1182c3"/>
<hc:Shield Subject="IDE" Status="2017" Margin="4,0,0,0" Color="#1182c3"/>
<hc:Shield Subject="chat" Status="on gitter" Margin="4,0,0,0" Color="#4eb899" Command="hc:ControlCommands.OpenLink" CommandParameter="https://gitter.im/HandyControl/Lobby?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge"/>
<hc:Shield Subject="qq" Status="714704041" Margin="4,0,0,0" Color="#d8624c" Command="hc:ControlCommands.OpenLink" CommandParameter="http://shang.qq.com/wpa/qunwpa?idkey=a571e5553c9d41e49c4f22f3a8b2865451497a795ff281fedf3285def247efc1"/>
</StackPanel>
```
@@ -0,0 +1,4 @@
interface:
display_name: "HandyControl WPF Shield 徽章"
short_description: "Implement HandyControl WPF controls from verified source guidance"
default_prompt: "Use $handycontrol-wpf-shield to implement the requested HandyControl WPF UI."
@@ -0,0 +1,14 @@
# 源码 API 导航
下面是当前工作区的声明摘录,不是完整 C# 文件,不包含全部继承成员、访问器和条件编译条件。属性是否可写、依赖属性默认值、枚举成员和目标框架限制,需打开对应源码核对。
## Shield
源码:[src/Shared/HandyControl_Shared/Controls/Other/Shield.cs](https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControl_Shared/Controls/Other/Shield.cs)
```text
public class Shield : ButtonBase
public string Subject
public object Status
public Brush Color
```
@@ -0,0 +1,17 @@
# Shield 徽章 使用导航
文档:[doc/source/handycontrol/extend_controls/shield/index.md](https://github.com/HandyOrg/HandyControl/blob/master/doc/source/handycontrol/extend_controls/shield/index.md)
在线文档:[控件说明](https://handyorg.github.io/handycontrol/extend_controls/shield/)
按任务阅读原文中的章节:属性、案例。
## 当前源码
- [src/Shared/HandyControl_Shared/Controls/Other/Shield.cs](https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControl_Shared/Controls/Other/Shield.cs)
## 样式及官方示例
- [src/Shared/HandyControl_Shared/Themes/Styles/Shield.xaml](https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControl_Shared/Themes/Styles/Shield.xaml)
- [src/Shared/HandyControlDemo_Shared/UserControl/Controls/ShieldDemo.xaml](https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ShieldDemo.xaml)
- [src/Shared/HandyControlDemo_Shared/UserControl/Controls/ShieldDemo.xaml.cs](https://github.com/HandyOrg/HandyControl/blob/master/src/Shared/HandyControlDemo_Shared/UserControl/Controls/ShieldDemo.xaml.cs)