mcpField
S
syncfusion-wpf-timespan-editor

syncfusion-wpf-timespan-editor

github.com/syncfusionDevelopment5158 installsUpdated 1w ago
Repository

About syncfusion-wpf-timespan-editor

A reference skill for using Syncfusion TimeSpanEdit in WPF to enter or display durations. It covers custom formats, keyboard and mouse interaction, value constraints, and theming.

Key features

  1. 01Duration display and editing
  2. 02Custom formats and field labels
  3. 03Keyboard, wheel, and drag interaction
  4. 04Minimum and maximum constraints
  5. 05Null values and read-only mode

Use cases

  1. 01Enter durations in a WPF application
  2. 02Display time intervals with custom labels
  3. 03Set allowed duration bounds
  4. 04Show durations in read-only views

Install

Copy the command and run it in a terminal.

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

After installing, type/syncfusion-wpf-timespan-editorin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
appearance-and-theming.md
constraints-and-events.md
getting-started.md
user-interactions.md
value-and-formats.md

Details

From the project README

Implementing Syncfusion WPF TimeSpanEdit

The TimeSpanEdit control allows users to set or display time as Days:Hours:Minutes:Seconds (d.h:m:s) format with support for keyboard and mouse interactions, custom formatting, and theming.

When to Use This Skill

Use the TimeSpanEdit control when you need to:

  • Capture or display time durations/intervals in your WPF application
  • Provide Days:Hours:Minutes:Seconds input with a user-friendly interface
  • Enable users to increment/decrement time values using keyboard, mouse wheel, or buttons
  • Display time with custom formats and labels (e.g., "5 days, 3 hours, 15 minutes, 30 sec")
  • Apply min/max constraints to limit allowed time ranges
  • Support null values with watermark text for empty states
  • Style the control with colors, themes, and RTL support

Component Overview

Key Capabilities:

  • ✓ Display time as Days:Hours:Minutes:Seconds (with milliseconds support)
  • ✓ Programmatic and user-based value changes
  • ✓ Keyboard navigation between fields (arrow keys)
  • ✓ Mouse wheel and click-drag interactions
  • ✓ Custom format strings with field labels
  • ✓ Min/Max value constraints
  • ✓ ValueChanged event notifications
  • ✓ ReadOnly mode for display-only scenarios
  • ✓ Null value support with watermarks
  • ✓ Theme integration (SfSkinManager, ThemeStudio)
  • ✓ RTL (Right-to-Left) flow direction support

Documentation Guide

TopicFileFocus
Setupgetting-started.mdInstall NuGet, add via Designer/XAML/C#
Formatsvalue-and-formats.mdCustom format strings, labels, milliseconds
Interactionsuser-interactions.mdKeyboard, mouse, buttons, drag, arrow keys
Constraints & Eventsconstraints-and-events.mdMin/Max, ValueChanged event, validation
Appearanceappearance-and-theming.mdColors, themes, RTL, SfSkinManager

Quick Start Example

XAML:

<Window xmlns:syncfusion="http://schemas.syncfusion.com/wpf">
    <Grid>
        <!-- Basic TimeSpanEdit -->
        <syncfusion:TimeSpanEdit 
            x:Name="timeSpanEdit"
            Value="5.12:30:45"
            Width="150"
            Height="30" />
    </Grid>
</Window>

C# Code-Behind:

using Syncfusion.Windows.Shared;

public partial class MainWindow : Window {
    public MainWindow() {
        InitializeComponent();
        
        // Create and configure TimeSpanEdit
        TimeSpanEdit editor = new TimeSpanEdit();
        editor.Value = new TimeSpan(5, 12, 30, 45);
        editor.Width = 150;
        editor.Height = 30;
        
        this.Content = editor;
    }
}

Assembly Reference: Add this to your WPF project:

  • Syncfusion.Shared.WPF

Common Patterns

Use CaseXAML Setup
With ConstraintsMinValue="2.00:00:00" MaxValue="10.00:00:00"
Custom FormatFormat="d 'days' h 'hours' m 'minutes' s 'seconds'"
Precise IntervalsStepInterval="1.00:15:30" IncrementOnScrolling="True"
Read-OnlyIsReadOnly="True" ShowArrowButtons="False"
NullableAllowNull="True" NullString="Enter duration..."

Quick Example:

<!-- Constrained input with custom format -->
<syncfusion:TimeSpanEdit 
    Value="5.08:30:00"
    MinValue="2.00:00:00"
    MaxValue="10.00:00:00"
    Format="d 'days' h 'hours'" />

Key Props Reference

PropertyTypeDefaultPurpose
ValueTimeSpan?0.0:0:0The time duration to display/edit
Formatstringd.h:m:sCustom format string (d=days, h=hours, m=minutes, s=seconds, z=milliseconds)
MinValueTimeSpan—Minimum allowed time duration
MaxValueTimeSpan—Maximum allowed time duration
StepIntervalTimeSpan1.01:01:01Increment/decrement interval for buttons/wheel/keyboard
AllowNullboolfalseAllow null/empty values
NullStringstring""Watermark text when value is null
ShowArrowButtonsbooltrueShow up/down spinner buttons
IncrementOnScrollingbooltrueAllow mouse wheel to change values
EnableExtendedScrollingboolfalseAllow click & drag to change values
IsReadOnlyboolfalsePrevent user edits (read-only mode)
BackgroundBrushWhiteControl background color
ForegroundBrushBlackText color
SelectionBrushBrushRoyalBlueSelection highlight color
FlowDirectionFlowDirectionLeftToRightRTL support (RightToLeft)

Common Use Cases

ScenarioKey Settings
Duration InputEnable buttons, wheel, keyboard; set Min/Max; use labels
Display OnlyIsReadOnly="True" ShowArrowButtons="False"; use clear format
Precise ControlSet StepInterval (e.g., 15-min); field-by-field keyboard entry
Flexible EntryAll interactions enabled; logical step intervals; visual feedback

Next Steps

  1. Start with Getting Started: Read getting-started.md to set up the control
  2. Format Your Display: Check value-and-formats.md for custom formats
  3. Enable Interactions: Review user-interactions.md for optimal UX
  4. Add Logic: Use constraints-and-events.md for events and limits
  5. Style It: Apply colors and themes with appearance-and-theming.md

Comments

Markdown supported