I am not able to set the weekday format in Scheduler for month view. I am using the control in a very small area, and I need to set the weekday names to be abbreviated (Mon, Tue, Wed, etc.).
I have set the HeaderFormat property on both the GetMonthView() and the scheduler control, and it does not seem to change. I still see the weekday names fully spelled out, and Wednesday will not fit into the allocated area.
6 Answers, 1 is accepted
Thank you for writing.
In order to achieve your goal, it is suitable to use the CellFormatting event and assign the desired string to the respective header cells:
public
Form1()
{
InitializeComponent();
this
.radScheduler1.CellFormatting+=radScheduler1_CellFormatting;
this
.radScheduler1.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Month;
}
private
void
radScheduler1_CellFormatting(
object
sender, Telerik.WinControls.UI.SchedulerCellEventArgs e)
{
SchedulerHeaderCellElement headerCell = e.CellElement
as
SchedulerHeaderCellElement;
if
(headerCell!=
null
)
{
string
pattern = headerCell.Date.DayOfWeek.ToString().Substring(0, 3);
if
(headerCell.Text.Length!=pattern.Length&&headerCell.Text.StartsWith(pattern))
{
headerCell.Text = pattern;
}
}
}
I hope this information helps. Should you have further questions, I would be glad to help.
Dess
Telerik
This didn't quite work for me, but it set me on the right track. My header cells don't seem to have a valid Date property. All of them seem to be 1/1/1980, which happens to be a Tuesday, so Tuesday gets set correctly to Tue. I am not using a navigator, I don't know if this makes a difference.
Anyhow, your basic idea did work with a slight modification:
private void rsReserve_CellFormatting(object sender, SchedulerCellEventArgs e)
{
SchedulerHeaderCellElement headerCell = e.CellElement as SchedulerHeaderCellElement;
if (headerCell != null && headerCell.Text.EndsWith("day"))
{
headerCell.Text = headerCell.Text.Substring(0, 3);
}
}
Thank you for writing back.
I have attached my sample project as well. Feel free to use this approach which suits your requirement best.
I hope this information helps. If you have any additional questions, please let me know.
Dess
Telerik
Hi,
The datasource that I bind to the scheduler contains hours for example 2021-01-16 14:00 to 2021-01-17 12:00
but when I bind it to the scheduler, both the 16th and 17th are filled.
How can I have only half of 16th and 17th filled rather all days.
Thanks
RadScheduler supports functionality to arrange appointments according to their start time and duration. The EnableExactTimeRendering property allows you to control whether the appointment start and end time should be rendered exactly. By default its value is false. Feel free to set it to true and thus the appointment is expected to occupy only the respective time interval: https://docs.telerik.com/devtools/winforms/controls/scheduler/views/exact-time-rendering
Please have in mind that due to the great difference in the amount of time, which different time scales represent, appointments might become too small to render accurately in larger time scales.
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.
Hi Dess,
Thank you, this worked perfectly.
Best regards,
Fahmi