Articles in this section
Category / Section

How to hide done and cancel buttons at the footer of SfTimePicker?

1 min read

By default, the done and cancel button is visible in the SfTimePicker. To hide the done and cancel buttons, the ShowCancelButton and ShowDoneButton need to set to False using the SelectorStyle of SfTimeSelector. 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"  >
<syncfusion:SfTimePicker.SelectorStyle>
<Style TargetType="syncfusion:SfTimeSelector">
<Setter Property="ShowCancelButton" Value="False"/>
<Setter Property="ShowDoneButton" Value="False"/>
</Style>
</syncfusion:SfTimePicker.SelectorStyle>
</syncfusion:SfTimePicker >
</Grid>
</Window>

 

C#:

namespace WpfApplication6
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
SfTimePicker TimePicker = new SfTimePicker();
TimePicker.VerticalAlignment = VerticalAlignment.Center;
TimePicker.HorizontalAlignment = HorizontalAlignment.Center;
TimePicker.Width = 200;
Style style = new Style(typeof(SfTimeSelector));
style.Setters.Add(new Setter(SfTimeSelector.ShowCancelButtonProperty, false));
style.Setters.Add(new Setter(SfTimeSelector.ShowDoneButtonProperty, false));
TimePicker.SelectorStyle = style;
Grid1.Children.Add(TimePicker);
 
}
}
}

 

Output:

 

 

                                                      

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied