ComponentOne DateTimeEditors for WPF
DatePicker Overview / C1DatePicker Task-Based Help / Allowing Null Values
In This Topic
    Allowing Null Values
    In This Topic

    By default, the C1DatePicker control doesn't allow users to enter null values, but you can force the control to accept a null value by setting the C1DatePicker.AllowNull property to True. In this topic, you will learn how to set the AllowNull property to True in the designer, in XAML, and in code.

    In the Designer

    Complete the following steps:

    1. Click the C1DatePicker control once to select it.
    2. In the Visual Studio Properties window, select the AllowNull check box.

    In XAML

    To allow null values, place AllowNull="True" within the <c1:C1DatePicker> tags so that the markup resembles the following:

    <c1:C1DatePicker AllowNull="True"/>
    

    In Code

    Complete the following steps:

    1. Open the MainWindow.xaml.cs page.
    2. Place the following code beneath the InitializeComponent() method:
      Visual Basic
      Copy Code
      C1DatePicker1.AllowNull = True
      
      C#
      Copy Code
      c1DatePicker1.AllowNull = true;
      
    3. Run the project.