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

[Solved] RadMenu - Customizing DEFAULT skin

6 Answers 172 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
MeetJayBlack
Top achievements
Rank 1
MeetJayBlack asked on 13 Jun 2008, 09:26 AM
I'm using the RADMenu with DEFAULT skin. Now the problem is that with the DEFAULT skin on Hover of Menu is shows up with a white background. I wanted to change that color to a light Blue color but unfortunately I'm not able to do so.

Can anyone help me on customizing the DEFAULT skin for the RADMenu.

Thanks.

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 13 Jun 2008, 10:16 AM
Hi,

Go through the following help article.
Setting the CSS Class of Items

Thanks
Shinu
0
Ed
Top achievements
Rank 1
answered on 13 Jun 2008, 10:47 AM
That was very useful for me, too ... almost!  The help article says:

You can use a small CSS class with the white-space:normal attribute to change the item so that it wraps to a specified width:

1 ...
2 ...

and then proceeds to describe how to create a CSS class to make the text wrap for long menu items.  Nowhere does it show how to actually specify the width, however.

I want to have it so that all items with text longer than 400px will be wrapped -- is this possible?

Ed Graham
0
Peter
Telerik team
answered on 16 Jun 2008, 02:59 PM
Hello Ed,

You can set GroupSettings.Width for the parent item to achieve the desired effect. For example, please try the following code:

<head runat="server">  
    <title>Untitled Page</title> 
    <style> 
    .WrappingItem  
    {  
      white-space: normal;  
    }  
   </style> 
 
</head> 
<body> 
    <form id="form1" runat="server">  
    <asp:ScriptManager ID="ScriptManager1" runat="server">  
    </asp:ScriptManager> 
    <telerik:RadMenu ID="RadMenu1" runat="server">  
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
        <Items> 
            <telerik:RadMenuItem runat="server" Text="Root RadMenuItem1">  
            </telerik:RadMenuItem> 
            <telerik:RadMenuItem runat="server" Text="Root RadMenuItem2">  
            </telerik:RadMenuItem> 
            <telerik:RadMenuItem runat="server" Text="Root RadMenuItem3">  
                <Items> 
                    <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 1">  
                    </telerik:RadMenuItem> 
                    <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 2">  
                    </telerik:RadMenuItem> 
                    <telerik:RadMenuItem runat="server" CssClass="WrappingItem" Text="Child RadMenuItem 3 with some  very very  very very  very very  very very  very very long text">  
                    </telerik:RadMenuItem> 
                </Items> 
                <GroupSettings Width="400px" /> 
            </telerik:RadMenuItem> 
        </Items> 
    </telerik:RadMenu> 
    </form> 
</body> 


Best Wishes,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ed
Top achievements
Rank 1
answered on 16 Jun 2008, 05:41 PM
That's excellent, Peter; thanks very much.  I don't suppose there's a way of specifying the width so that only those menus containing items longer than 400px (say) will be fixed at 400px wide, with all "narrower" menus remaining at their natural widths?  I have a mixture of menus, some with just a few items (which are therefore usually less than 400px long) and some with many items (one or two of which may be very long, hence the need to wrap).

Perhaps the only way to do this would be to keep track of the widths of the controls dynamically somehow, and use the GroupSettings.Width property only when the maximum width is greater than 400px?  Your opinion would be appreciated in any case.

Thanks,

Ed
0
Peter
Telerik team
answered on 17 Jun 2008, 08:35 AM
Hello Ed,

I am thinking about the same approach -  "keep track of the widths of the controls dynamically somehow, and use the GroupSettings.Width property only when the maximum width is greater than 400px". For example, you can try something like this:
protected void Page_Load(object sender, EventArgs e)  
    {  
        foreach (RadMenuItem item1 in RadMenu1.GetAllItems())  
        {  
            if (item1.Text.Length > 120)//The value "120" is just for an example  
            {                 
                RadMenuItem parentItem = (RadMenuItem)item1.Parent;  
                parentItem.GroupSettings.Width = Unit.Pixel(400);  
            }  
        }  
    } 



Greetings,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Ed
Top achievements
Rank 1
answered on 17 Jun 2008, 08:35 PM
Thanks for that, Peter.
Tags
General Discussions
Asked by
MeetJayBlack
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Ed
Top achievements
Rank 1
Peter
Telerik team
Share this question
or