ComponentOne DateTimeEditors for UWP
C1DateTime Picker Help / C1DateTimePicker Task-Based Help / Allowing Null Values
In This Topic
    Allowing Null Values
    In This Topic

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

    In the Designer

    Complete the following steps:

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

    In XAML

    To allow null values, place AllowNull="True" to the <DateTimeEditors:C1DateTimePicker>tag so that the markup resembles the following:

    Markup
    Copy Code
    <DateTimeEditors:C1DateTimePicker AllowNull="True"/>
    

     

    In Code

    Complete the following steps:

    1. Open the MainPage.xaml.cs page.
    2. Place the following code beneath the C1DateTimePicker_Loaded event:
    Visual Basic
    Copy Code
    C1DateTimePicker1.AllowNull = True
    

     

    C#
    Copy Code
    c1DateTimePicker1.AllowNull = true;
    
    1. Run the project.
    See Also