Articles in this section
Category / Section

How to customize the scheduler header in Xamarin?

1 min read

You can customize the header of SfSchedule in Xamarin.Forms by using VisibileDatesChangedEvent.

XAML

Set the HeaderHeight property to zero to hide the default header. Instead of the Schedule header labels used to show the Schedule header.

<Grid Grid.Row="1">
    <Grid.RowDefinitions>
        <RowDefinition Height="0.1*"/>
        <RowDefinition Height="0.9*"/>
    </Grid.RowDefinitions>
    <Label BackgroundColor="White" x:Name="dayHeader" Padding="30,0,0,0" Grid.Row="0" TextColor="Black" VerticalTextAlignment="Center" />
    <Label BackgroundColor="White" x:Name="weekHeader" Grid.Row="0" IsVisible="False" TextColor="Black" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"/>
    <schedule:SfSchedule x:Name="Schedule"
                            DataSource="{Binding Meetings}"
                            HeaderHeight="0"
                            Grid.Row="1"
                            Margin="0">
     </Grid>
</Grid>

 

C#

Header content updated in SfSchedule's VisibleDatesChangedEvent when changing the view.

 

private void Schedule_VisibleDatesChangedEvent(object sender, Syncfusion.SfSchedule.XForms.VisibleDatesChangedEventArgs e)
{
            if (schedule.ScheduleView == ScheduleView.DayView)
            {
                dayHeader.Text = e.visibleDates[0].ToString("MMMM yyyy");
            }
            else if (schedule.ScheduleView == ScheduleView.WeekView)
            {
                weekHeader.Text = e.visibleDates[0].ToString("MMMM yyyy");
            }
}

C#

Header visibility has been handled when  ScheduleView  changed dynamically.

private void ScheduleViewButton_Clicked(object sender, EventArgs e)
{
            if (schedule.ScheduleView == ScheduleView.WeekView)
            {
                schedule.ScheduleView = ScheduleView.DayView;
                dayHeader.IsVisible = true;
                weekHeader.IsVisible = false;
            }
            else
            {
                schedule.ScheduleView = ScheduleView.WeekView;
                dayHeader.IsVisible = false;
                weekHeader.IsVisible = true;
            }
 }

View sample in GitHub




Conclusion

I hope you enjoyed learning how to customize the scheduler header in Xamarin.

You can refer to our Xamarin. Forms Schedule feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Xamarin. Forms Schedule example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other 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