PersianDatePicker.WinForms 1.0.0

dotnet add package PersianDatePicker.WinForms --version 1.0.0
                    
NuGet\Install-Package PersianDatePicker.WinForms -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PersianDatePicker.WinForms" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PersianDatePicker.WinForms" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="PersianDatePicker.WinForms" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PersianDatePicker.WinForms --version 1.0.0
                    
#r "nuget: PersianDatePicker.WinForms, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PersianDatePicker.WinForms@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PersianDatePicker.WinForms&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=PersianDatePicker.WinForms&version=1.0.0
                    
Install as a Cake Tool

PersianDatePicker.WinForms

A Persian (Jalali) DatePicker control for Windows Forms applications built with .NET 10.

Features

  • Persian (Jalali) calendar
  • Right-to-left (RTL) support
  • Persian digit display
  • Today button
  • Clear button
  • Calendar dialog for date selection
  • Nullable DateOnly value
  • Simple WinForms integration
  • Compatible with Entity Framework Core
  • Suitable for applications using SQLite and other EF Core providers

Requirements

  • .NET 10
  • Windows Forms
  • Windows

Installation

Install the package using the .NET CLI:

dotnet add package PersianDatePicker.WinForms

Or install it from the NuGet Package Manager in Visual Studio.

Usage

Add the following namespace:

using PersianDatePicker.WinForms.Controls;

Create the control:

var datePicker = new PersianDatePicker
{
    Width = 250
};

Controls.Add(datePicker);

You can also set an initial value:

datePicker.Value = DateOnly.FromDateTime(DateTime.Today);

Getting the Selected Date

The selected date is available through the Value property:

DateOnly? selectedDate = datePicker.Value;

Because the property is nullable, it can also contain null when no date is selected.

Setting a Date

You can assign a DateOnly value directly:

datePicker.Value = new DateOnly(1405, 6, 18);

Clearing the Date

Set Value to null to clear the selected date:

datePicker.Value = null;

The control also provides a Clear button inside the calendar dialog.

Selecting Today

The calendar dialog provides a Today button that selects the current date.

ValueChanged Event

The ValueChanged event is raised whenever the selected date changes:

datePicker.ValueChanged += (sender, e) =>
{
    DateOnly? selectedDate = datePicker.Value;
};

Entity Framework Core

The control returns a DateOnly? value, which can be assigned directly to an Entity Framework Core entity property.

For example:

public class Order
{
    public long Id { get; set; }

    public DateOnly OrderDate { get; set; }
}

You can assign the selected date:

order.OrderDate = datePicker.Value!.Value;

Then save the entity normally using Entity Framework Core:

db.Orders.Add(order);
await db.SaveChangesAsync();

Date Queries

Because the control returns DateOnly, dates can be used directly in Entity Framework Core queries.

Query by Date

var date = new DateOnly(1405, 6, 18);

var orders = await db.Orders
    .Where(x => x.OrderDate == date)
    .ToListAsync();

Query by Date Range

var fromDate = new DateOnly(1405, 6, 1);
var toDate = new DateOnly(1405, 6, 31);

var orders = await db.Orders
    .Where(x =>
        x.OrderDate >= fromDate &&
        x.OrderDate <= toDate)
    .OrderBy(x => x.OrderDate)
    .ToListAsync();

Display Format

The selected date is displayed using the Persian calendar and Persian digits.

Example:

۱۴۰۵/۰۶/۱۸

The displayed format does not change the underlying value. The control still exposes the selected date as:

DateOnly?

Example

A simple Windows Forms example:

using PersianDatePicker.WinForms.Controls;

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

        var datePicker = new PersianDatePicker
        {
            Location = new Point(30, 30),
            Width = 250
        };

        datePicker.Value = DateOnly.FromDateTime(DateTime.Today);

        Controls.Add(datePicker);
    }
}

License

MIT License

Copyright (c) 2026 Saeed Noruzi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Product Compatible and additional computed target framework versions.
.NET net10.0-windows7.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 45 9/16/2026