关于 syncfusion-wpf-radial-slider
面向 WPF 应用开发者的 SfRadialSlider 指南,介绍数值范围、圆弧行为、刻度、标签、指针和中心内容的配置。
主要功能
- 01数值范围与步长设置
- 02可配置圆弧角度和方向
- 03自定义刻度与标签
- 04指针及预览指针样式
- 05内圈内容模板
适用场景
- 01构建温度选择器
- 02创建整圆或部分圆弧控件
- 03将选择值按固定步长对齐
- 04在中心显示格式化数值
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ syncfusion/ wpf-ui-components-skills --skill syncfusion-wpf-radial-slider安装后在 Claude Code 中输入/syncfusion-wpf-radial-slider确认已加载。
包含的文件
除 SKILL.md 外,安装时一起下载的参考资料和脚本。
references/appearance.mdgetting-started.mdticks-and-templates.mdvalue-and-range.md详细介绍
实现 SfRadialSlider(WPF)
何时使用此技能
在以下情况下使用此技能:
- 为 WPF 应用添加圆形/径向数值选择器
- 配置数值范围(Minimum、Maximum)、步进间隔(SmallChange)或刻度间距(TickFrequency)
- 自定义圆形轨道的起始角度、结束角度和扫掠方向
- 使用 Content 或 ContentTemplate 在内圈中显示所选值
- 使用 DataTemplates 自定义刻度、刻度标签、指针或预览指针
- 通过 DrawLabel 事件动态设置刻度标签文本格式
- 设置内圈、外圈、前景和背景的样式
组件概览
SfRadialSlider
├── Outer rim — circular track background (Background, OuterRimStroke)
├── Ticks — tick marks on the track (TickRadiusFactor, TickTemplate)
├── Labels — tick value labels (LabelRadiusFactor, LabelTemplate, DrawLabel)
├── Pointer — selection indicator (PointerRadiusFactor, PointerStyle)
├── Preview pointer — hover indicator (PreviewPointerStyle)
└── Inner rim — center circle content area (InnerRimRadiusFactor, InnerRimFill, Content)
程序集:
Syncfusion.SfRadialMenu.WPFSyncfusion.SfShared.WPF
命名空间: Syncfusion.Windows.Controls.Navigation
XAML 架构: http://schemas.syncfusion.com/wpf
文档与导航指南
入门
📄 阅读: references/getting-started.md
- 程序集引用和命名空间
- 创建 XAML 和 C# 控件
- 通过拖动或单击选择值
- 以编程方式设置 Value
- ValueChanged 事件
- 使用 SfSkinManager 设置主题
数值和范围配置
📄 阅读: references/value-and-range.md
- Value / Minimum / Maximum
- 在内容区域显示数值(Content + ContentTemplate)
- SmallChange — 步进间隔
- TickFrequency — 刻度间距
- ShowMaximumValue — 当最大值不是刻度间隔的倍数时显示最大值
- StartAngle / EndAngle — 圆弧范围
- SweepDirection — 顺时针或逆时针
刻度、标签和模板
📄 阅读: references/ticks-and-templates.md
- TickRadiusFactor / TickVisibility / TickTemplate
- LabelRadiusFactor / LabelVisibility / LabelTemplate
- InnerRimRadiusFactor / OuterRimRadiusFactor
- PointerRadiusFactor / PointerStyle
- PreviewPointerStyle
- DrawLabel 事件 — 设置每个标签的文本、颜色和字体
外观和样式
📄 阅读: references/appearance.md
- Foreground / Background
- InnerRimFill / InnerRimStroke / InnerRimStrokeThickness
- OuterRimStroke / OuterRimStrokeThickness
- FlowDirection(RTL)
- SfSkinManager 主题
快速入门
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
<syncfusion:SfRadialSlider Name="radialSlider"
Height="200" Width="200"/>
using Syncfusion.Windows.Controls.Navigation;
SfRadialSlider radialSlider = new SfRadialSlider();
radialSlider.Height = 200;
radialSlider.Width = 200;
this.Content = radialSlider;
在内圈中显示所选值:
<syncfusion:SfRadialSlider Value="{Binding SelectedValue, Mode=TwoWay}"
Content="{Binding SelectedValue, Mode=TwoWay}"
Height="200" Width="200">
<syncfusion:SfRadialSlider.DataContext>
<local:ViewModel/>
</syncfusion:SfRadialSlider.DataContext>
</syncfusion:SfRadialSlider>
常见模式
| 场景 | 方法 |
|---|---|
| 温度选择器,范围为 0–100 | Minimum="0" Maximum="100" |
| 完整圆形与圆弧 | StartAngle="0" EndAngle="360" 与 StartAngle="90" EndAngle="330" |
| 按 5 的倍数对齐 | SmallChange="5" |
| 减少刻度数量 | TickFrequency="20" |
| 逆时针圆弧 | SweepDirection="Counterclockwise" |
| 显示最大值标签 | ShowMaximumValue="True" |
| 按数值为标签着色 | 处理 DrawLabel 事件 |
| 自定义指针样式 | 将 PointerStyle 与 TargetType="syncfusion:RadialPointer" 配合使用 |
| 在中心显示格式化数值 | 使用包含绑定 TextBlock 的 ContentTemplate |
关键属性
| 属性 | 默认值 | 描述 |
|---|---|---|
Value | 0 | 当前选定的值 |
Minimum | 0 | 刻度最小值 |
Maximum | 100 | 刻度最大值 |
SmallChange | 0.1 | 可选的最小增量 |
TickFrequency | 10 | 显示刻度之间的间距 |
ShowMaximumValue | false | 当最大值不是 TickFrequency 的倍数时显示最大值 |
StartAngle | 0 | 圆弧的起始角度 |
EndAngle | 360 | 圆弧的结束角度 |
SweepDirection | Clockwise | 刻度方向 |
Content | null | 内圈中显示的内容 |
ContentTemplate | null | 内圈内容的 DataTemplate |
InnerRimRadiusFactor | 0.2 | 内圆半径(0–1) |
OuterRimRadiusFactor | 0.7 | 外圆半径(0–1) |
TickRadiusFactor | 0.72 | 刻度标记的位置半径 |
LabelRadiusFactor | 0.87 | 标签的位置半径 |
PointerRadiusFactor | 0.75 | 指针的位置半径 |
TickVisibility | Visible | 显示/隐藏刻度标记 |
LabelVisibility | Visible | 显示/隐藏刻度标签 |
评论
支持 Markdown