Skip to content

This repository contains a sample on How to customize the header in the Syncfusion Xamarin.Forms Schedule (SfSchedule)?

Notifications You must be signed in to change notification settings

SyncfusionExamples/schedule-header-customization-xamarin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

How to customize the schedule header in Xamarin.Forms Schedule (SfSchedule)

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;
      }
 }

About

This repository contains a sample on How to customize the header in the Syncfusion Xamarin.Forms Schedule (SfSchedule)?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages