How to set a null value to SfDatePicker?
The value in the SfDatePicker can be set as Null by setting the AllowNull Property to True. The same has been demonstrated in the following sample.
XAML:
<Page x:Class="App4.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:App4" xmlns:navigation="using:Syncfusion.UI.Xaml.Controls.Navigation" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:syncfusion="using:Syncfusion.UI.Xaml.Controls.Input" mc:Ignorable="d"> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> <syncfusion:SfDatePicker x:Name="Picker" Width="100" Height="23" AllowNull="True" /> </Grid> </Page>
C#:
using Windows.UI.Xaml.Input; // The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 namespace App4 { /// <summary> /// An empty page that can be used on its own or navigated to within a Frame. /// </summary> public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); SfDatePicker Picker = new SfDatePicker(); Picker.Width = 100; Picker.Height = 23; Picker.AllowNull = true; Grid1.Children.Add(Picker); } } } |
Output: