Category / Section
How to display more looping items in the DateSelector of WPF DatePicker (SfDatePicker)?
1 min read
The number of LoopingSelectorItems (which are displayed in the Looping Selector) is based on the height of the each looping item and the available height of the SfDateSelector of WPF DatePicker (SfDatePicker). By default, the height of the sSelector and the looping item are set to 500 and 80 respectively, sohence the number of LoopingSelectorItem the displayed LoopingSelectorItem is 5. Based on the required number of LoopingSelectorItems, youwe should change the height of the Selector. The following code demonstrates the same.
Mainwindow.xaml:
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition /> <ColumnDefinition/> </Grid.ColumnDefinitions> <syncfusion:SfDateSelector x:Name="DateSelector" Grid.Column="1" AccentBrush="Black" Background="Transparent" BorderBrush="Transparent" FormatString="yyyy-MMM-dd" BorderThickness="2" ShowCancelButton="False" ShowDoneButton="False"> </syncfusion:SfDateSelector> </Grid>
Mainwindow.cs
public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); this.SizeChanged += MainWindow_SizeChanged; } private void MainWindow_SizeChanged(object sender, SizeChangedEventArgs e) { if(this.ActualHeight != 0) { DateSelector.Height = this.ActualHeight; } } }