项目作者: pymendoza

项目描述 :
Custom datetimepicker control for Windows Forms that allows databinding to a nullable DateTime field
高级语言: C#
项目地址: git://github.com/pymendoza/NullableBindingDateTimePicker.git
创建时间: 2019-05-05T13:51:45Z
项目社区:https://github.com/pymendoza/NullableBindingDateTimePicker

开源协议:MIT License

下载


NullableBindingDateTimePicker

Custom datetimepicker control for Windows Forms that allows databinding to a nullable DateTime field. Null datetime value is represented by an unchecked checkbox on the datetimepicker.

How to use:

  1. From Visual Studio Toolbox, drag and drop custom control to your form:


  1. Set the databindings to the Value property



    1. public partial class Form1 : Form
      {
      public Person Person = new Person();

    2. public Form1()
      {

    3.  InitializeComponent();
    4.  nullableBindingDateTimePicker1.DataBindings
    5.      .Add("Value", Person, "Birthdate", true, DataSourceUpdateMode.OnPropertyChanged);
    6.  // Show underlying bound field value
    7.  label2.DataBindings.Add("Text", Person, "Birthdate");
    8. }
      }

public class Person
{
public DateTime? BirthDate { get; set; }
}