This is a migrated thread and some comments may be shown as answers.

Can't Change Theme on RadContextMenu

3 Answers 150 Views
ContextMenu
This is a migrated thread and some comments may be shown as answers.
BECK
Top achievements
Rank 1
BECK asked on 02 Nov 2010, 05:09 PM
I don't like the default RadContextMenu look of bumpy buttons. I tried changing the theme but with no luck. Is there a property I'm missing that would remove that look of raised (bumpy) buttons? Basically I'm looking for a way to make look more like the regular windows Context Menu String control's look. 

Thanks

3 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 02 Nov 2010, 09:49 PM
Hi BECK,

The context will take on the theme of the item that it is the context menu for. So, on a RadGridView, you would theme the RadGridView to get the context menu in the example below to become themed.

Private Sub GridView_ContextMenuOpening(ByVal sender As System.Object, _
    ByVal e As ContextMenuOpeningEventArgs) Handles RadGridView.ContextMenuOpening
    If TypeOf e.ContextMenuProvider Is Telerik.WinControls.UI.GridDataCellElement _
    AndAlso RadGridView.SelectedRows.Count > 0 Then
        ' Clear any current items if you don't want the default menu
        e.ContextMenu.Items.Clear()
        'Declare a context menu item
        Dim contextMenuItemMyItem As New RadMenuItem()
        ' Add the item
        With contextMenuItemMyItem
            .Text = "My Item"
            .Image = Me.ImageList.Images(0)
            .ToolTipText = "A Tooltip"
            .Enabled = True
        End With
        'Insert it at a position
        e.ContextMenu.Items.Insert(0, contextMenuItemMyItem)
        'Add a handler
        AddHandler contextMenuItemMyItem.Click, AddressOf ContextMenuItemMyItem_Click
    End If
End Sub
Private Sub ContextMenuItemMyItem_Click(ByVal sender As Object, ByVal e As EventArgs)
    ' Do Something
End Sub

On the default theme there are no bumpy buttons that I can see. (see screenshot).
On the telerik theme for example (the RadGridView with the telerik theme) will cause the context menu to change the look and feel. (see second screenshot)

Hope that helps
richard
0
BECK
Top achievements
Rank 1
answered on 02 Nov 2010, 10:37 PM
I wasn't aware that the context menu inherits the theme from the control it's being tied to. I probably missed that in the documentation. So there isn't a way I can theme a context menu independently then?

0
Richard Slade
Top achievements
Rank 2
answered on 03 Nov 2010, 11:15 AM
Hi BECK, 

Because the RadContextMenu is made up of RadMenuItems, you should be able to use the Visual Style Builder to create your own styles on the RadMenuItems. 
Have a look at this link for information on theming. 

Hope that helps
Richard
Tags
ContextMenu
Asked by
BECK
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
BECK
Top achievements
Rank 1
Share this question
or