# Allowing Null Values

## Content



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 <span data-popup-content="This class is available in \u003ca href=\u0022/componentone/api/wpf/online-datetimeeditors/dotnet-api/C1.WPF.DateTimeEditors/C1.WPF.DateTimeEditors.C1DateTimePicker.AllowNull.html\u0022\u003e.NET\u003c/a\u003e and \u003ca href=\u0022/componentone/api/wpf/online-datetimeeditors/dotnet-api/C1.WPF.DateTimeEditors/C1.WPF.DateTimeEditors.C1DateTimePicker.AllowNull.html\u0022\u003e.NET Framework\u003c/a\u003e." data-popup-title="C1DateTimePicker.AllowNull" data-popup-theme="ui-tooltip-green qtip-green">C1DateTimePicker.AllowNull</span> 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 **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 _<my:C1DateTimePicker>_ tag so that the markup resembles the following:

```auto
<my:C1DateTimePicker AllowNull="True"/>
```

**In Code**

Complete the following steps:

1.  Open the **Window1.xaml.cs** page.
2.  Place the following code beneath the **InitializeComponent()** method:
    
    ```vbnet
    C1DateTimePicker1.AllowNull = True
    ```
    
    ```csharp
    c1DateTimePicker1.AllowNull = true;
    ```
    
3.  Run the project.


> type=info
> **Tip**: to set null value at run-time, users should either clear all the text in the **DatePicker** portion of the control and press ENTER or move focus to the **TimeEditor** portion of the control.