Class DaysViewSettings
Represents a class which is used to configure all the properties of DayView, WeekView and WorkWeekView.
Implements
Inherited Members
Namespace: Syncfusion.UI.Xaml.Scheduler
Assembly: Syncfusion.SfScheduler.WPF.dll
Syntax
public class DaysViewSettings : TimeSlotViewSettings, IDisposable
Constructors
DaysViewSettings()
Initializes a new instance of the DaysViewSettings class.
Declaration
public DaysViewSettings()
Properties
AllDayAppointmentTemplate
Gets or sets all day appointment template to change the default UI of appointment.
Declaration
public DataTemplate AllDayAppointmentTemplate { get; set; }
Property Value
Type |
---|
System.Windows.DataTemplate |
Examples
The following sample used to configure the custom appointments and all day appointment template.
# [Model.cs](#tab/tabid-1)public class Meeting
{
public string EventName { get; set; }
public DateTime From { get; set; }
public DateTime To { get; set; }
public bool IsAllDay { get; set; }
public Brush BackgroundBrush { get; set; }
}
# [ViewModel.cs](#tab/tabid-2)
var customAppointments = new ObservableCollection<Meeting>();
var meeting = new Meeting()
{
EventName = "General Meeting",
From = new DateTime(2020, 11, 25, 09, 0, 0),
To = new DateTime(2020, 11, 25, 10, 0, 0),
BackgroundBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFA2C139")),
};
customAppointments.Add(meeting);
this.scheduler.ItemsSource = customAppointments;
# [MainWindow](#tab/tabid-3)
<Window.Resources>
<DataTemplate x:Key="alldayAppointmentTemplate">
<StackPanel Background = "{Binding Data.BackgroundBrush}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch">
<TextBlock
Text = "{Binding Data.EventName}"
VerticalAlignment="Center"
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap"
TextAlignment="Left"/>
</StackPanel>
</DataTemplate>
</Window.Resources>
<syncfusion:SfScheduler x:Name="schedule">
<syncfusion:SfScheduler.DaysViewSettings>
<syncfusion:DaysViewSettings AllDayAppointmentTemplate = "{StaticResource alldayAppointmentTemplate}" />
</ syncfusion:SfScheduler.DaysViewSettings>
<syncfusion:SfScheduler.AppointmentMapping>
<syncfusion:AppointmentMapping
Subject = "EventName"
StartTime="From"
EndTime="To"
IsAllDay="IsAllDay"
AppointmentBackground="BackgroundBrush"/>
</syncfusion:SfScheduler.AppointmentMapping>
</syncfusion:SfScheduler>
AllDayAppointmentTemplateSelector
Gets or sets all day appointment template selector to change the default UI of appointment based on the condition.
Declaration
public DataTemplateSelector AllDayAppointmentTemplateSelector { get; set; }
Property Value
Type |
---|
System.Windows.Controls.DataTemplateSelector |
Examples
The following sample used to configure the custom appointments and all day appointment template selector.
# [Model.cs](#tab/tabid-a)public class Meeting
{
public string EventName { get; set; }
public DateTime From { get; set; }
public DateTime To { get; set; }
public bool IsAllDay { get; set; }
public Brush BackgroundBrush { get; set; }
}
# [ViewModel.cs](#tab/tabid-b)
var customAppointments = new ObservableCollection<Meeting>();
var meeting = new Meeting()
{
EventName = "General Meeting",
From = new DateTime(2020, 11, 25, 09, 0, 0),
To = new DateTime(2020, 11, 25, 10, 0, 0),
BackgroundBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFA2C139")),
};
customAppointments.Add(meeting);
this.scheduler.ItemsSource = customAppointments;
# [TemplateSelector.cs](#tab/tabid-c)
public class DataTemplateSelectorHelper : DataTemplateSelector
{
public DataTemplate AppointmentTemplate { get; set; }
public DataTemplate AllDayAppointmentTemplate { get; set; }
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
if ((item as ScheduleAppointment).IsAllDay)
{
return AllDayAppointmentTemplate;
}
return AppointmentTemplate;
}
}
# [MainWindow](#tab/tabid-d)
<Window.Resources>
<DataTemplate x:Key="appointmentTemplate">
<StackPanel Background = "{Binding Data.BackgroundBrush}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch">
<TextBlock
Text = "{Binding Data.EventName}"
VerticalAlignment="Center"
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap"
TextAlignment="Left"/>
</StackPanel>
</DataTemplate>
<DataTemplate x:Key="allDayAppointmentTemplate">
<StackPanel Background = "{Binding Data.BackgroundBrush}"
VerticalAlignment="Stretch"
HorizontalAlignment="Stretch">
<TextBlock
Text = "{Binding Data.EventName}"
VerticalAlignment="Center"
TextTrimming="CharacterEllipsis"
TextWrapping="Wrap"
TextAlignment="Left"/>
</StackPanel>
</DataTemplate>
<local:DataTemplateSelectorHelper x:Key="dataTemplateSelector"
AppointmentTemplate="{StaticResource appointmentTemplate}"
AllDayAppointmentTemplate="{StaticResource allDayAppointmentTemplate}" />
</Window.Resources>
<syncfusion:SfScheduler x:Name="schedule">
<syncfusion:SfScheduler.DaysViewSettings>
<syncfusion:DaysViewSettings AllDayAppointmentTemplateSelector="{StaticResource dataTemplateSelector}"/>
</ syncfusion:SfScheduler.DaysViewSettings>
<syncfusion:SfScheduler.AppointmentMapping>
<syncfusion:AppointmentMapping
Subject = "EventName"
StartTime="From"
EndTime="To"
AppointmentBackground="BackgroundBrush"
IsAllDay="IsAllDay"/>
</syncfusion:SfScheduler.AppointmentMapping>
</syncfusion:SfScheduler>
AllDayMoreAppointmentsIndicatorTemplate
Gets or sets the template that is used to display the more appointments indicator view in the day, week, and workweek views of all day appointment view panel.
Declaration
public DataTemplate AllDayMoreAppointmentsIndicatorTemplate { get; set; }
Property Value
Type |
---|
System.Windows.DataTemplate |
Remarks
The DataContext of the AllDayMoreAppointmentsIndicatorTemplate is an integer that denotes count of appointments not in view.
Examples
The following sample used to configure the more appointments indicator template.
#[C#](#tab/tabid-e)var scheduleAppointments = new ScheduleAppointmentCollection();
for (int i = 0; i < 5; i++)
{
var scheduleAppointment = new ScheduleAppointment()
{
Subject = "General Meeting",
StartTime = new DateTime(2021, 04, 30, 09, 0, 0),
EndTime = new DateTime(2021, 04, 30, 10, 0, 0),
AppointmentBackground = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFA2C139")),
IsAllDay = true,
};
scheduleAppointments.Add(scheduleAppointment);
}
this.Schedule.ItemsSource = scheduleAppointments;
# [Xaml](#tab/tabid-f)
<syncfusion:SfScheduler x:Name="Schedule">
<syncfusion:SfScheduler.DaysViewSettings>
<syncfusion:DaysViewSettings>
<syncfusion:DaysViewSettings.AllDayMoreAppointmentsIndicatorTemplate>
<DataTemplate >
<TextBlock Text="{Binding StringFormat=+{0}}" Background="LightBlue" Foreground="Black"
HorizontalAlignment="Stretch" TextAlignment="Left" VerticalAlignment="Stretch" >
</TextBlock>
</DataTemplate>
</syncfusion:DaysViewSettings.AllDayMoreAppointmentsIndicatorTemplate>
</syncfusion:DaysViewSettings>
</syncfusion:SfScheduler.DaysViewSettings>
</syncfusion:SfScheduler>
CellRightPadding
Gets or sets the option to include spacing between a cell's appointment and its border on the right side to interact with a scheduler cell that contains appointments.
Declaration
public int CellRightPadding { get; set; }
Property Value
Type | Description |
---|---|
System.Int32 | The default value is 10. |
Remarks
This property is applicable only when the ItemsSource property is enabled or when appointments are present in the scheduler.
Examples
#C#
this.scheduler.DaysViewSettings.CellRightPadding = 5;
#Xaml
<scheduler:SfScheduler x:Name="scheduler">
<scheduler:SfScheduler.DaysViewSettings>
<scheduler:DaysViewSettings CellRightPadding = "5" />
</scheduler:SfScheduler.DaysViewSettings>
</scheduler:SfScheduler>
MinimumAllDayAppointmentsCount
Gets or sets a minimum all day appointments count when all day expander in collapsed state.
Declaration
public int MinimumAllDayAppointmentsCount { get; set; }
Property Value
Type |
---|
System.Int32 |
Methods
Dispose(Boolean)
Disposes all the resources used by the DaysViewSettings class.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | Indicates whether the call is from Dispose method or from a System.GC.SuppressFinalize(System.Object). |