Drop down list as in scheduler edit appointment

3 posts, 1 answers
  1. Peter
    Peter avatar
    10 posts
    Member since:
    Nov 2015

    Posted 07 Dec 2015 Link to this post


    I have made my own Edit appointment form, and want to make a dropdownlist, just as the 'Background' selector.

    I simply can't figure out, how load the background colors in the scheduler into the dropdown.  

    My code look like this:

           Dim a As Int16

            Dim list(Me.uiRadSchedulerMain.Backgrounds.Count - 1) As String
            For a = 0 To Me.uiRadSchedulerMain.Backgrounds.Count - 1

                Dim dataItem As New RadListDataItem()
                dataItem.Text = Me.uiRadSchedulerMain.Backgrounds.Item(a).DisplayName.ToString
                dataItem.Image = ??? (background of backgrounds.item(a).[Image]) 
                dataItem.Value = Me.uiRadSchedulerMain.Backgrounds.Item(a).Id



    Kindly Peter

  2. Answer
    Dess | Tech Support Engineer, Sr.
    Dess | Tech Support Engineer, Sr.  avatar
    4166 posts

    Posted 08 Dec 2015 Link to this post

    Hello Peter,

    Thank you for writing back.
    Here is a sample code snippet demonstrating how to create a RadDropDownList similar to the one filled with scheduler's backgrounds:
    Public Class CustomAppointmentEditForm
        Private Function CreateImageByBackgroundInfo(backgroundInfo As IAppointmentBackgroundInfo) As Image
            Dim defaultImageSize As New Size(11, 11)
            Dim image As New Bitmap(defaultImageSize.Width, defaultImageSize.Height)
            Dim graphics__1 As Graphics = Graphics.FromImage(image)
            Dim rect As New Rectangle(Point.Empty, defaultImageSize)
            rect.Inflate(-1, -1)
            Using path As GraphicsPath = (New RoundRectShape(1)).CreatePath(rect)
                Using gradientBrush As New LinearGradientBrush(rect, backgroundInfo.BackColor, _
                                                               backgroundInfo.BackColor2, backgroundInfo.GradientAngle)
                    graphics__1.FillPath(gradientBrush, path)
                End Using
                Using pen As New Pen(backgroundInfo.BorderColor)
                    graphics__1.DrawPath(pen, path)
                End Using
            End Using
            Return image
        End Function
        Protected Overrides Sub LoadBackgrounds()
            Dim scheduler As RadScheduler = TryCast(Me.SchedulerData, RadScheduler)
            Me.RadDropDownList1.DataSource = scheduler.GetBackgroundStorage()
            Me.RadDropDownList1.DisplayMember = "DisplayName"
            Me.RadDropDownList1.ValueMember = "Id"
            For Each item As RadListDataItem In Me.RadDropDownList1.Items
                item.Image = CreateImageByBackgroundInfo(item.DataBoundItem)
        End Sub
    End Class

    I hope this information helps. If you have any additional questions, please let me know.

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Peter
    Peter avatar
    10 posts
    Member since:
    Nov 2015

    Posted 09 Dec 2015 in reply to Dess | Tech Support Engineer, Sr. Link to this post


    Thank you. Great help.

Back to Top