Category / Section
How to set null value to a SfTimePicker?
To set the null value for SfTimePicker, AllowNull property need to enable along with the Value property set as Null. The same has been demonstrated in the following code example:
XAML:
<Window x:Class="WpfApplication6.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Title="MainWindow" Height="350" Width="525">
<Grid x:Name="Grid1">
<syncfusion:SfTimePicker VerticalAlignment="Center" Width="200" HorizontalAlignment="Center" Value="{x:Null}" AllowNull="True" />
</Grid>
</Window>
C#:
namespace WpfApplication6
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
SfTimePicker TimePicker = new SfTimePicker();
TimePicker.VerticalAlignment = VerticalAlignment.Center;
TimePicker.HorizontalAlignment = HorizontalAlignment.Center;
TimePicker.Width = 200;
TimePicker.Value = null;
TimePicker.AllowNull = true;
Grid1.Children.Add(TimePicker);
}
}
}
Output:
