7 Answers, 1 is accepted
Thank you for your question.
You can achieve this by creating and using a descendant class of RadScheduler. The following code snippet demonstrates how you can achieve this:
public
class
MyScheduler : RadScheduler
{
public
override
void
InvalidateElement(Telerik.WinControls.RadElement element)
{
if
(
this
.ActiveViewType != SchedulerViewType.Timeline)
{
base
.InvalidateElement(element);
return
;
}
foreach
(RadElement child
in
(
this
.SchedulerElement.ViewElement
as
SchedulerTimelineViewElement).Presenter.Children)
{
SchedulerCellElement cell = (child
as
SchedulerCellElement);
if
(cell !=
null
)
{
if
(cell.Date.DayOfWeek == DayOfWeek.Sunday || cell.Date.DayOfWeek == DayOfWeek.Saturday)
{
cell.BackColor = Color.Red;
}
else
{
cell.ResetValue(RadItem.BackColorProperty, ValueResetFlags.Local);
}
}
}
base
.InvalidateElement(element);
}
public
override
string
ThemeClassName
{
get
{
return
typeof
(RadScheduler).FullName;
}
set
{
base
.ThemeClassName = value;
}
}
}
I hope this is helpful. Feel free to ask if you have any additional questions.
Regards,
Ivan Todorov
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
That works nicely.
I have updated my form with the inherited version of the control by updating the designer.vb file but is there a way I can do this in code in a similar way the drag & drop example assigns the MyGridBehavior class to
NameOfGrid.GridBehavior = New MyGridBehavior()
Thanks
This is not possible in this case, because you are inheriting directly from the main RadScheduler control and not from a part of it.
Do not hesitate to ask if you have any further questions.
All the best,
Ivan Todorov
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
Thanks.
Thank you for writing.
This is happening, because when you switch between views, the ActiveViewType property is changed, but some of the elements are initialized yet. I have updated the previously posted code, so that the exception does not occur. Below is the modified sample:
public
override
void
InvalidateElement(Telerik.WinControls.RadElement element)
{
if
(
this
.ActiveViewType != SchedulerViewType.Timeline)
{
base
.InvalidateElement(element);
return
;
}
SchedulerTimelineViewElement timelineElement =
this
.SchedulerElement.ViewElement
as
SchedulerTimelineViewElement;
if
(timelineElement ==
null
|| timelineElement.Presenter==
null
)
{
return
;
}
foreach
(RadElement child
in
timelineElement.Presenter.Children)
{
SchedulerCellElement cell = (child
as
SchedulerCellElement);
if
(cell !=
null
)
{
if
(cell.Date.DayOfWeek == DayOfWeek.Sunday || cell.Date.DayOfWeek == DayOfWeek.Saturday)
{
cell.BackColor = Color.Red;
}
else
{
cell.ResetValue(RadItem.BackColorProperty, ValueResetFlags.Local);
}
}
}
}
I hope you find this useful. Do not hesitate to ask in case you have any additional questions.
Best wishes,
Ivan Todorov
the Telerik team
Q2’11 SP1 of RadControls for WinForms is available for download (see what's new); also available is the Q3'11 Roadmap for Telerik Windows Forms controls.
http://demos.telerik.com/kendo-ui/scheduler/timeline
In this example, the weekends have their color in red, to show its weekends.
How do one set this in the kendo scheduler?
Regards
Rasmus
Thank you for writing.
Note that this forum is related to the Telerik UI for WinForms product. If you have any questions regarding Kendo UI, feel free to post in the relevant forum: http://www.telerik.com/forums
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik