Articles in this section
Category / Section

How to include custom header using axml file in Xamarin.Android schedule?

1 min read

You can create and add custom header in schedule by following the steps:

 

  1. Set the Schedule.HeaderHeight property to zero to hide the default header.
  2. Create and add your own custom header in axml file in schedule.

AXML

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <TextView
        android:id="@+id/customHeader"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@android:color/holo_blue_light"
        android:textSize="?android:attr/windowTitleSize" />
    <Com.Syncfusion.Schedule.SfSchedule
        android:id="@+id/schedule"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
</LinearLayout>

 

  1. Using the Schedule.VisibleDatesChanged event, get the visible month and set to the custom header.

C#

private void Schedule_VisibleDatesChanged(object sender, VisibleDatesChangedEventArgs e)
        {
            var dateList = e.VisibleDates;
            var dateFomater = new SimpleDateFormat("LLLL yyyy", Schedule.Locale);
 
            if (Schedule.ScheduleView == ScheduleView.MonthView)
                CustomHeader.Text = dateFomater.Format(dateList[dateList.Count / 2].Time);
            else
                CustomHeader.Text = dateFomater.Format(dateList[0].Time);
        }

 

Example: ScheduleCustomHeader_Android

 

 

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