Category / Section
How to customize AgendaView height based on schedule height?
1 min read
AgendaView height customization based on SfSchedule height
The SfSchedule allows you to customize AgendaView height in runtime. This article explains how to customize the AgendaView height based on schedule height and device orientation in runtime.
Step 1: Initialize an event handler for the SizeChanged event of SfSchedule.
schedule.SizeChanged += OnScheduleSizeChanged;
Step 2: In the SizeChanged event handler, get SfSchedule height and based on SfSchedule height and orientation, calculate height for AgendaView and assign it to the AgendaViewHeight property of SfSchedule MonthViewSettings.
private void OnScheduleSizeChanged(object sender, EventArgs e) { var scheduler = sender as SfSchedule; if(scheduler.Width > scheduler.Height && Device.RuntimePlatform != Device.UWP) { schedule.MonthViewSettings.AgendaViewHeight = schedule.Height * 0.3; } else { schedule.MonthViewSettings.AgendaViewHeight = schedule.Height * 0.5; } }
Sample Demo: AgendaHeightCustomization