This is a migrated thread and some comments may be shown as answers.
problem in ElementRender event
1 Answer 39 Views
This is a migrated thread and some comments may be shown as answers.
Milanesi
Top achievements
Rank 1
Milanesi asked on 29 Aug 2008, 03:13 PM

I'm writing this follow source code in VS2008 and I nocited that the first time the calendar load hasn't the days highlights. If I move to the next or previous month and then I come back to Agoust the days are correctly highlights. I might be doing something wrong, but what ???

Private Sub RadCalendar1_ElementRender(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.RenderElementEventArgs) Handles RadCalendar1.ElementRender

Dim ProcessOK As Boolean = False

Dim dates As List(Of DateTime) = New List(Of DateTime)()

dates.Add(

New DateTime(2008, 8, 11, 0, 0, 0, 0))

dates.Add(

New DateTime(2008, 8, 12, 0, 0, 0, 0))

dates.Add(

New DateTime(2008, 8, 13, 0, 0, 0, 0))

dates.Add(

New DateTime(2008, 8, 14, 0, 0, 0, 0))

Dim i As Integer = 0

Do While i < dates.Count

If dates(i).Date.Equals(e.Day.Date) Then

ProcessOK =

True

End If

i += 1

Loop

If ProcessOK Then

e.Element.DrawFill =

True

If cellBackColor = Color.Empty Then

cellBackColor = e.Element.BackColor

End If

e.Element.BackColor = Color.Orange

e.Element.Invalidate()

Else

If cellBackColor <> Color.Empty Then

e.Element.BackColor = cellBackColor

End If

If Not (TryCast(e.Element, CalendarCellElement)).Selected Then

e.Element.DrawFill =

False

Else

TryCast(e.Element, CalendarCellElement).Selected = True

e.Element.DrawFill =

True

End If

End If

ProcessOK =

False

End Sub

1 Answer, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 01 Sep 2008, 04:16 PM
Hi Milanesi,

Thank you for the question.

In order to initially show the custom visual representation for specific cells, you should call the InvalidateCalendar() in the Form constructor or in the Form_Load event handler:
Me.RadCalendar1.InvalidateCalendar(); 

If you have additional questions, feel free to contact me.

Kind regards,
Nikolay
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Asked by
Milanesi
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or