problem in ElementRender event

2 posts, 0 answers
  1. Milanesi
    Milanesi avatar
    2 posts
    Member since:
    Aug 2008

    Posted 29 Aug 2008 Link to this post


    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

  2. Nikolay
    Admin
    Nikolay avatar
    1803 posts

    Posted 01 Sep 2008 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top