Scheduler Ruler
The ruler in RadScheduler is used to show the time intervals of the current view.
The ruler has various properties which can be used to modify its appearance. The examples below demonstrate the various behaviors of the ruler. The ruler can be accessed as follows:
RulerPrimitive ruler = (this.scheduler.SchedulerElement.ViewElement as SchedulerDayViewElement).DataAreaElement.Ruler;
Dim ruler As RulerPrimitive = TryCast(Me.scheduler.SchedulerElement.ViewElement, SchedulerDayViewElement).DataAreaElement.Ruler
- TimePointerStyle - Sets the style of the pointer which shows the current time. Can be Arrow, Line or SimpleLine.
ruler.TimePointerStyle = RulerCurrentTimePointer.Arrow;
ruler.TimePointerStyle = RulerCurrentTimePointer.Arrow
- Start and EndScale - Sets the time when the ruler starts and ends.
ruler.StartScale = 2;
ruler.EndScale = 9;
ruler.StartScale = 2
ruler.EndScale = 9
- RangeFactor - The range factor determines whether the units in the ruler will be devided in FiveMinutes, HalfHour, Hour, QuarterHour, SixMinutes or TenMinutes.
ruler.RangeFactor = ScaleRange.FiveMinutes;
ruler.RangeFactor = ScaleRange.FiveMinutes
- CurrentTimePointerWidth and CurrentTimePointerColor - Sets the size and the color of the pointer which shows the current time.
ruler.CurrentTimePointerWidth = 10;
ruler.CurrentTimePointerColor = Color.Red;
ruler.CurrentTimePointerWidth = 10
ruler.CurrentTimePointerColor = Color.Red
- RulerFormatStrings and the RulerTextFormatting event - They are used to format the text in the ruler. For example here is how to display the hours in a 12 hours format:
ruler.FormatStrings = new RulerFormatStrings("hh", "mm", "hh", "mm");
ruler.FormatStrings = New RulerFormatStrings("hh", "mm", "hh", "mm")
The RulerTextFormatting event can be used to manually format the text. You can prepend a "0" in front of the text if it contains only one digit:
this.scheduler.RulerTextFormatting += Scheduler_RulerTextFormatting;
AddHandler Me.scheduler.RulerTextFormatting, AddressOf Scheduler_RulerTextFormatting
void Scheduler_RulerTextFormatting(object sender, RulerTextFormattingEventArgs e)
{
if (e.Text.Length == 1)
{
e.Text = "0" + e.Text;
}
}
Private Sub Scheduler_RulerTextFormatting(sender As Object, e As RulerTextFormattingEventArgs)
If e.Text.Length = 1 Then
e.Text = "0" & e.Text
End If
End Sub
- RulerWidth - Sets the width of the ruler.
ruler.RulerWidth = 100;
ruler.RulerWidth = 100