Can't Change Theme on RadContextMenu

4 posts, 0 answers
  1. BECK
    BECK avatar
    15 posts
    Member since:
    Oct 2010

    Posted 02 Nov 2010 Link to this post

    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
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 02 Nov 2010 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. BECK
    BECK avatar
    15 posts
    Member since:
    Oct 2010

    Posted 02 Nov 2010 Link to this post

    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?

  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 03 Nov 2010 Link to this post

    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
Back to Top