Loading...
Loading...
Implements the Syncfusion WPF DatePicker (SfDatePicker) control for touch-friendly date selection. Use this when adding date input controls, customizing date picker appearance, formatting date displays, or restricting date ranges in WPF applications. Covers installation, date formatting, styling, customization, value management, and event handling.
npx skill4agent add syncfusion/wpf-ui-components-skills syncfusion-wpf-datepicker<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Title="DatePicker Sample">
<Grid>
<syncfusion:SfDatePicker x:Name="sfDatePicker"
Width="200"
Value="3/19/2026"/>
</Grid>
</Window>using Syncfusion.Windows.Controls.Input;
SfDatePicker sfDatePicker = new SfDatePicker();
sfDatePicker.Value = new DateTime(2026, 3, 19);
sfDatePicker.Width = 200;
this.Content = sfDatePicker;sfDatePicker.ValueChanged += (d, e) =>
{
DateTime oldDate = (DateTime)e.OldValue;
DateTime newDate = (DateTime)e.NewValue;
Console.WriteLine($"Date changed from {oldDate:d} to {newDate:d}");
};<!-- Display as month only -->
<syncfusion:SfDatePicker FormatString="M" x:Name="sfDatePicker"/>sfDatePicker.MinDate = new DateTime(2026, 1, 1);
sfDatePicker.MaxDate = new DateTime(2026, 12, 31);<syncfusion:SfDatePicker AllowNull="True"
Value="{x:Null}"
Watermark="Select a date"
x:Name="sfDatePicker"/><syncfusion:SfDatePicker AllowInlineEditing="True"
InputScope="Number"
x:Name="sfDatePicker"/><syncfusion:SfDatePicker Foreground="Blue"
Background="LightGray"
AccentBrush="Green"
x:Name="sfDatePicker"/>| Property | Type | Default | Purpose |
|---|---|---|---|
| Value | DateTime? | Current date | Selected date |
| FormatString | string | "d" | Display date format |
| SelectorFormatString | string | "M/d/yyyy" | Dropdown selector format |
| AllowNull | bool | false | Allow null values |
| Watermark | string | null | Placeholder text |
| MinDate | DateTime | Min value | Earliest selectable date |
| MaxDate | DateTime | Max value | Latest selectable date |
| AllowInlineEditing | bool | false | Enable inline date editing |
| ShowDropDownButton | bool | true | Show/hide dropdown button |
| DropDownHeight | double | Auto | Height of dropdown popup |
| Foreground | Brush | Black | Text color |
| Background | Brush | White | Control background |
| AccentBrush | Brush | Blue | Selected item highlight |