Here is an example of a bindable DateTimePicker with NULL binding support.
It is just a fw lines of code, so no need to download... Just copy and paste. ;)
Hope it helps
Duray AKAR
public class DateTimePickerNullable: System.Windows.Forms.DateTimePicker, INotifyPropertyChanged
{
public DateTimePickerNullable()
: base()
{
ShowCheckBox = true;
}
[Bindable(true)]
public Nullable<DateTime> BindableValue
{
get
{
if (Checked)
{
return Value;
}
else
{
return null;
}
}
set
{
if (value.HasValue && value.Value > DateTime.MinValue)
{
this.Checked = true;
}
else
{
this.Checked = false;
}
}
}
public new bool Checked
{
get { return base.Checked; }
set
{
base.Checked = value;
OnPropertyChanged("BindableValue");
}
}
protected override void OnCloseUp(EventArgs eventargs)
{
base.OnCloseUp(eventargs);
OnPropertyChanged("BindableValue");
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged!=null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
}