New to Telerik UI for .NET MAUI? Start a free 30-day trial
Using x:DataType in Scheduler Day/Week Templates in .NET MAUI
Updated over 6 months ago
Environment
| Version | Product | Author |
|---|---|---|
| 11.0.0 | Telerik UI for .NET MAUI Scheduler | Dobrinka Yordanova |
Description
I want to use a custom appointment class with the Scheduler's DayView and WeekView templates in .NET MAUI. However, I am unsure of the correct x:DataType declaration for the AppointmentTemplate. When using custom properties in the appointment class, warnings appear, but the application still builds and runs correctly.
This knowledge base article also answers the following questions:
- How do I set the
x:DataTypefor Scheduler templates? - What is the
x:DataTypeforAppointmentTemplatein .NET MAUI Scheduler? - How to use a custom appointment class with Scheduler templates?
Solution
To correctly set the x:DataType for the Scheduler's AppointmentTemplate, use the AppointmentNode. Below is an example of how to declare the x:DataType in XAML:
xaml
<DataTemplate x:DataType="telerik:AppointmentNode">
<!-- Template content goes here -->
</DataTemplate>
If using a custom appointment class that inherits from Appointment, warnings may appear for custom properties. These warnings do not affect the application's build or runtime behavior.