I would like to know how to programatically change the backcolor of a RadMenu Item that I am adding to a RadDropDownButton:
Private Sub LoadColors() |
Me.ddlPatientColor.Items.Add(Me.CreateMenuItem("Red", "Red")) |
Me.ddlPatientColor.Items.Add(Me.CreateMenuItem("Green", "Green")) |
Me.ddlPatientColor.Items.Add(Me.CreateMenuItem("Blue", "Blue")) |
Me.ddlPatientColor.Items.Add(Me.CreateMenuItem("Purple", "Purple")) |
Me.ddlPatientColor.Items.Add(Me.CreateMenuItem("Black", "Black")) |
Me.ddlPatientColor.Items.Add(Me.CreateMenuItem("Brown", "Brown")) |
Me.ddlPatientColor.Items.Add(Me.CreateMenuItem("Orange", "Orange")) |
Me.ddlPatientColor.Items.Add(Me.CreateMenuItem("Yellow", "Yellow")) |
Me.ddlPatientColor.Items.Add(Me.CreateMenuItem("Pink", "Pink")) |
End Sub |
Private Function CreateMenuItem(ByVal Text As String, ByVal Value As String) As RadMenuItem |
Dim RadMenuItem As RadMenuItem = New RadMenuItem() |
RadMenuItem.Name = Value |
RadMenuItem.Text = Text |
RadMenuItem.BackColor = Color.FromName(Value) |
RadMenuItem.Font = New System.Drawing.Font("Arial", 20.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) |
RadMenuItem.TextAlignment = ContentAlignment.MiddleLeft |
RadMenuItem.AutoSize = False |
RadMenuItem.Size = New System.Drawing.Size(243, 41) |
AddHandler RadMenuItem.Click, AddressOf ColorChosen |
Return RadMenuItem |
End Function |