Articles in this section
Category / Section

How to customize the header using DataTemplate in the .NET MAUI Scheduler (SfScheduler)?

4 mins read

The .NET MAUI Scheduler allows you to customize the header using the HeaderTemplate property of the SchedulerHeaderView. This guide will explain how to utilize DataTemplate to customize the header appearance effectively.

The BindingContext of the HeaderTemplate is the SchedulerHeaderDetails. You can leverage the properties of SchedulerHeaderDetails within the data template to meet your requirements.

XAML

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="HeaderTemplate.MainPage"
             BackgroundColor="{DynamicResource SecondaryColor}"
             xmlns:scheduler="clr-namespace:Syncfusion.Maui.Scheduler;assembly=Syncfusion.Maui.Scheduler">
 
    <Grid>
        <Grid.Resources>
            <DataTemplate x:Key="headerTemplate">
                <Grid Background ="Pink">
                    <Label x:Name="label" TextColor="DarkBlue" HorizontalOptions="Center" VerticalOptions="Center">
                        <Label.Text>
                            <MultiBinding StringFormat = "{}{0:MMM dd, yyyy} - {1:MMM dd, yyyy}">
                                <Binding Path="StartDate" />
                                <Binding Path = "EndDate" />
                            </MultiBinding>
                        </Label.Text>
                    </Label>
                    <Label  HorizontalOptions="Center" VerticalOptions="End" Text="{Binding Text}" TextColor="Red" />
                </Grid>
            </DataTemplate>
        </Grid.Resources>
        <scheduler:SfScheduler x:Name="Scheduler" 
                           View="Week">
         
            <scheduler:SfScheduler.HeaderView>
                <scheduler:SchedulerHeaderView HeaderTemplate="{StaticResource headerTemplate}"/>
            </scheduler:SfScheduler.HeaderView>
        </scheduler:SfScheduler>
    </Grid>
</ContentPage>
 

Output

MAUI header template selector

 

 

Download the complete sample on GitHub

 

Conclusion
I hope you enjoyed learning h
ow to customize the header of a .NET MAUI Scheduler using a DataTemplate.

You can refer to our .NET MAUI Scheduler feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. Explore our .NET MAUI Scheduler example to understand how to create and manipulate data.

For current customers, you can check out our Document Processing Libraries from the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to check out our controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-trac, or feedback portal. We are always happy to assist you!

 

 

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied