ClassSpecialSlotStyleSelector
Represents an IStyleSelector that is used to select the style of the SchedulerBoxView that visualizes the special slot. This style selector enables conditional styling of special time slots based on their properties, such as read-only state, allowing different visual representations for different slot types.
Definition
Namespace:Telerik.Maui.Controls.Scheduler
Assembly:Telerik.Maui.Controls.dll
Syntax:
public class SpecialSlotStyleSelector : IStyleSelector
Inheritance: objectSpecialSlotStyleSelector
Implements:
Constructors
SpecialSlotStyleSelector()
Initializes a new instance of the SpecialSlotStyleSelector class.
Declaration
public SpecialSlotStyleSelector()
Properties
NormalStyle
Gets or sets the Style of the SchedulerBoxView that visualizes the special slot when in normal state. This style is applied to special slots that are not read-only and represents the default appearance.
Declaration
public Style NormalStyle { get; set; }
Property Value
Style
A Style object that defines the appearance of normal special slots.
Example
var normalStyle = new Style(typeof(SchedulerBoxView))
{
Setters =
{
new Setter { Property = SchedulerBoxView.ColorProperty, Value = Colors.LightGreen },
new Setter { Property = SchedulerBoxView.OpacityProperty, Value = 0.4 },
new Setter { Property = SchedulerBoxView.CornerRadiusProperty, Value = 5 }
}
};
specialSlotSelector.NormalStyle = normalStyle;
ReadOnlyStyle
Gets or sets the Style of the SchedulerBoxView that visualizes the special slot when it is read-only. This style is applied to special slots marked as read-only, typically indicating unavailable or restricted time periods.
Declaration
public Style ReadOnlyStyle { get; set; }
Property Value
Style
A Style object that defines the appearance of read-only special slots.
Example
var readOnlyStyle = new Style(typeof(SchedulerBoxView))
{
Setters =
{
new Setter { Property = SchedulerBoxView.ColorProperty, Value = Colors.Gray },
new Setter { Property = SchedulerBoxView.OpacityProperty, Value = 0.6 },
new Setter { Property = SchedulerBoxView.StrokeProperty, Value = Colors.DarkGray },
new Setter { Property = SchedulerBoxView.StrokeThicknessProperty, Value = 1 }
}
};
specialSlotSelector.ReadOnlyStyle = readOnlyStyle;
Methods
SelectStyle(object, BindableObject)
Override this method to return a specific custom Style. This method is called by the scheduler to determine which style to apply to each special slot based on the slot's properties and state.
Declaration
public Style SelectStyle(object item, BindableObject bindable)
Parameters
item
The data content representing the slot (SlotNode).
bindable
BindableObject
The SchedulerBoxView element to which the style will be applied.
Returns
Style
An app-specific style to apply, or null if no specific style should be applied.
Implements
Example
public class CustomSpecialSlotStyleSelector : SpecialSlotStyleSelector
{
public Style MaintenanceStyle { get; set; }
public Style LunchBreakStyle { get; set; }
public override Style SelectStyle(object item, BindableObject bindable)
{
if (item is SlotNode slotNode && bindable is SchedulerBoxView)
{
var slot = slotNode.Slot;
// Check custom slot properties or tags
if (slot.Data?.ToString() == "Maintenance")
{
return MaintenanceStyle;
}
if (slot.Data?.ToString() == "Lunch")
{
return LunchBreakStyle;
}
// Default behavior
return slot.IsReadOnly ? ReadOnlyStyle : NormalStyle;
}
return null;
}
}