Category / Section
How to include custom header using xib file in Xamarin.iOS Schedule?
You can create custom header and add this in schedule. To achieve this, follow below steps.
- Set Schedule.HeaderHeight property as zero to hide the default header
- Create your own xib file and add your own custom view and schedule on it.

C#
[Register ("MyViewCS")]
partial class MyView
{
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
UIKit.UILabel label { get; set; }
[Outlet]
[GeneratedCode ("iOS Designer", "1.0")]
Syncfusion.SfSchedule.iOS.SFSchedule schedule { get; set; }
void ReleaseDesignerOutlets ()
{
if (label != null) {
label.Dispose ();
label = null;
}
if (schedule != null) {
schedule.Dispose ();
schedule = null;
}
}
}
- Add the created view in ViewController Class
C#
public override void ViewDidLoad()
{
base.ViewDidLoad();
// Perform any additional setup after loading the view, typically from a nib.
var view = MyView.Create();
view.Frame = View.Frame;
View.AddSubview(view);
}
- Using Schedule.VisibleDatesChanged event get the visible month, and set this to custom header
C#
public static MyView Create()
{
var arguments = NSBundle.MainBundle.LoadNib("MyView", null, null);
view = Runtime.GetNSObject<MyView>(arguments.ValueAt(0));
view.schedule.HeaderHeight = 0;
view.schedule.VisibleDatesChanged += Schedule_VisibleDatesChanged;
view.label.BackgroundColor = UIColor.Blue;
return view;
}
static void Schedule_VisibleDatesChanged(object sender, Syncfusion.SfSchedule.iOS.VisibleDatesChangedEventArgs e)
{
var dateList = e.VisibleDates;
NSDateFormatter formatter = new NSDateFormatter();
formatter.DateFormat = "LLLL YYYY";
formatter.Locale = view.schedule.Locale;
if (view.schedule.ScheduleView == SFScheduleView.SFScheduleViewMonth)
view.label.Text = (NSString)formatter.ToString(dateList.GetItem<NSDate>(dateList.Count / 2));
else
view.label.Text = (NSString)formatter.ToString(dateList.GetItem<NSDate>(0));
}
Example: ScheduleCustomHeader_iOS
