How to hide the done and cancel button of WinRT DatePicker?
By default, done and cancel button is visible in the SfDatePicker. To hide the done and cancel button which appeared at the footer of SfDatePicker, the ShowDoneButton and ShowCancelButton property of the SfDatePicker need to set to False using the SelectorStyle of the SfDatePicker. The same has been demonstrated in the following code snippet:
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"
xmlns:Media="using:Syncfusion.UI.Xaml.Controls.Media"
xmlns:converters="using:Syncfusion.UI.Xaml.Converters"
mc:Ignorable="d">
<Grid x:Name="Grid1" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<syncfusion:SfDatePicker x:Name="_SfDatePicker" Width="100" Height="23">
<syncfusion:SfDatePicker.SelectorStyle>
<Style TargetType="syncfusion:SfDateSelector">
<Setter Property="ShowDoneButton" Value="False"/>
<Setter Property="ShowCancelButton" Value="False"/>
</Style>
</syncfusion:SfDatePicker.SelectorStyle>
</syncfusion:SfDatePicker>
</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 _SfDatePicker = new SfDatePicker();
_SfDatePicker.Width = 100;
_SfDatePicker.Height = 23;
Style style1 = new Style(typeof(SfDateSelector));
style1.Setters.Add(new Setter(SfDateSelector.ShowDoneButtonProperty, false));
style1.Setters.Add(new Setter(SfDateSelector.ShowCancelButtonProperty, false));
_SfDatePicker.SelectorStyle = style1;
Grid1.Children.Add(_SfDatePicker);
}
}
}
Output:
The following output shows no footer in the SfDatePicker.
