mcpField
S
syncfusion-wpf-step-progressbar

syncfusion-wpf-step-progressbar

github.com/syncfusion设计与 UI5152 次安装2 周前更新
代码仓库

关于 syncfusion-wpf-step-progressbar

面向构建顺序流程界面的开发者的 Syncfusion WPF SfStepProgressBar 指南,涵盖步骤状态、布局、数据绑定,以及用于自定义标记和内容的模板。

主要功能

  1. 01显示活动、非活动和不确定状态
  2. 02设置当前步骤的部分进度
  3. 03横向或纵向排列步骤
  4. 04从集合或 XML 绑定步骤
  5. 05自定义标记和步骤模板

适用场景

  1. 01跟踪订单配送阶段
  2. 02显示注册向导进度
  3. 03用自定义标记展示引导步骤
  4. 04在 MVVM 仪表板绑定步骤进度

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/syncfusion/wpf-ui-components-skills --skill syncfusion-wpf-step-progressbar

安装后在 Claude Code 中输入/syncfusion-wpf-step-progressbar确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

references/
appearance.md
data-binding-and-templates.md
getting-started.md
layouts.md
selected-item-and-status.md

详细介绍

实现 WPF SfStepProgressBar

SfStepProgressBar 是一个多步骤进度指示器,用于可视化顺序工作流。每个步骤都是一个 StepViewItem,具有活动、非活动或不确定状态。可将其用于订单跟踪、注册向导、结账流程、引导流程,或任何包含离散编号阶段的流程。

何时使用此技能

  • 用户需要逐步进度 UI(向导、结账、订单跟踪器)
  • 显示具有活动/非活动/进行中状态的多个阶段
  • 构建带自定义标记的垂直或水平步骤指示器
  • 从数据集合绑定步骤(MVVM/XML)
  • 按状态自定义标记形状、连接线颜色或步骤模板

快速开始

<Window
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Syncfusion="http://schemas.syncfusion.com/wpf"
    x:Class="MyApp.MainWindow">
    <Grid x:Name="grid">
        <Syncfusion:SfStepProgressBar SelectedIndex="2" SelectedItemStatus="Indeterminate">
            <Syncfusion:StepViewItem Content="Ordered" />
            <Syncfusion:StepViewItem Content="Packed" />
            <Syncfusion:StepViewItem Content="Shipped" />
            <Syncfusion:StepViewItem Content="Delivered" />
        </Syncfusion:SfStepProgressBar>
    </Grid>
</Window>
using Syncfusion.UI.Xaml.ProgressBar;

SfStepProgressBar stepProgressBar = new SfStepProgressBar();
stepProgressBar.Items.Add(new StepViewItem { Content = "Ordered" });
stepProgressBar.Items.Add(new StepViewItem { Content = "Packed" });
stepProgressBar.Items.Add(new StepViewItem { Content = "Shipped" });
stepProgressBar.Items.Add(new StepViewItem { Content = "Delivered" });
stepProgressBar.SelectedIndex = 2;
stepProgressBar.SelectedItemStatus = StepStatus.Indeterminate;
grid.Children.Add(stepProgressBar);
  • SelectedIndex — 最后一个活动步骤的从零开始的索引(此前的所有步骤都会变为 Active)
  • SelectedItemStatus — 所选步骤的状态:Active、Inactive 或 Indeterminate

文档与导航指南

入门

📄 阅读: references/getting-started.md

  • NuGet 包和程序集设置
  • XAML 命名空间和架构导入
  • 包含 4 个项目的基本步骤栏
  • 创建代码隐藏
  • 应用 SfSkinManager 主题
所选项目与状态

📄 阅读: references/selected-item-and-status.md

  • SelectedIndex — 控制哪个步骤处于活动状态
  • SelectedItemStatus(Active / Inactive / Indeterminate)
  • SelectedItemProgress — 当前步骤的部分填充
  • AnimationDuration — 步骤间的过渡速度
  • 动态推进步骤的 MVVM 绑定模式
外观

📄 阅读: references/appearance.md

  • MarkerShapeType(圆形或方形)
  • Orientation(水平或垂直)
  • 自定义连接线颜色和粗细
  • MarkerClicked 事件,用于实现点击导航行为
布局

📄 阅读: references/layouts.md

  • ItemsStretch:None / Fill / Auto
  • ItemSpacing — None 模式下的间距
  • MinimumItemSpacing — Fill 模式下的最小间距
  • 垂直布局中根据内容自动拉伸
数据绑定与模板

📄 阅读: references/data-binding-and-templates.md

  • 使用 ItemsSource + ItemContainerStyle 进行 MVVM 绑定
  • XML 数据源绑定
  • ItemTemplate — 自定义步骤标记内容
  • ItemTemplateSelector — 根据状态切换模板
  • MarkerTemplateSelector — 为每种步骤状态自定义标记
  • SecondaryContentTemplate — 标记下方/旁侧的标签
  • SecondaryContentTemplateSelector

关键属性

属性类型默认值用途
SelectedIndexint—最后一个活动步骤的从零开始的索引
SelectedItemStatusStepStatusInactive所选步骤的状态
SelectedItemProgressdouble100所选步骤的部分填充百分比
AnimationDurationTimeSpan500ms步骤过渡动画速度
OrientationOrientationHorizontal水平或垂直布局
MarkerShapeTypeMarkerShapeTypeCircle圆形或方形步骤标记
ActiveConnectorColorBrush—活动步骤之间连接线的颜色
ConnectorColorBrush—非活动步骤之间连接线的颜色
ConnectorThicknessdouble—连接线的粗细
ItemsStretchItemsStretchNone项目填充可用空间的方式
ItemSpacingdouble80步骤之间的间距(None 拉伸模式)

常见用例

  • 订单跟踪: 4 步进度条(已下单 → 已打包 → 已发货 → 已送达),并为运输中的步骤设置 SelectedItemStatus="Indeterminate"
  • 注册向导: 垂直排列,并设置 ItemsStretch="Fill" 以填满面板高度
  • 引导流程: 自定义 MarkerTemplateSelector,在已完成的步骤上显示对勾,在当前步骤上显示加载旋转图标
  • MVVM 仪表板: 将 ItemsSource 绑定到 ObservableCollection<StepItem>,并将 SelectedIndex 绑定到命令

评论

支持 Markdown