SuperAPI AI 工具集

syncfusion-wpf-timespan-editor

办公与效率

查看项目

更新于 10-15 23:56

技能介绍

用途:Syncfusion WPF 的 TimeSpanEdit 控件用于在 WPF 应用中输入或显示时长/时间间隔,格式为“天.时:分:秒”(d.h:m:s),支持毫秒。

主要能力:程序化与用户交互两种方式修改值;方向键在字段间切换,鼠标滚轮与点击拖拽调整;支持自定义格式字符串与字段标签(如“5 days, 3 hours”);可设 MinValue/MaxValue 限制范围;提供 ValueChanged 事件;支持只读模式、空值(AllowNull)与 NullString 水印;支持 SfSkinManager、ThemeStudio 主题及 RTL 流方向。

使用方式:引用程序集 Syncfusion.Shared.WPF,通过 NuGet 安装;可在 XAML 或 C# 中添加控件。基础 XAML:<syncfusion:TimeSpanEdit x:Name="timeSpanEdit" Value="5.12:30:45" Width="150" Height="30" />(需 xmlns:syncfusion="http://schemas.syncfusion.com/wpf")。C# 中可用 new TimeSpanEdit() 并设置 Value、Width、Height。常用属性包括 Value(TimeSpan?)、Format(默认 d.h:m:s,d/h/m/s/z 分别表示天/时/分/秒/毫秒)、MinValue、MaxValue、StepInterval、AllowNull、NullString、ShowArrowButtons、IncrementOnScrolling、EnableExtendedScrolling、IsReadOnly、Background、Foreground、SelectionBrush、FlowDirection。

适用场景:时长输入(启用按钮、滚轮、键盘并设范围与标签)、纯展示(IsReadOnly="True" 且 ShowArrowButtons="False")、精确控制(设 StepInterval 如 15 分钟并逐字段键盘录入)、灵活输入等。

限制:需安装 Syncfusion 组件并引用对应程序集;具体授权、价格与平台细节资料未提供。