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

[Solved] custom skin question on group links verus sub links

4 Answers 76 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Kevin Warnke
Top achievements
Rank 1
Kevin Warnke asked on 06 Apr 2009, 05:46 PM
I'm creating a custom skin for the menu component.  I think I've got everything looking the way I want except for this one issue.

The menu has some top level items that are links and some top level items that are groups that expand the submenu.

The items that are links in the top level need to be white in color.  The items that are in sub menus need to be black in color (both the sub group headers and sub menu links).

I can get all links to be white or black but can't figure out how to get the top level items white and sub menu items black.

Thanks for any help.

Kevin

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 07 Apr 2009, 05:56 AM
Hello Kevin,

I suppose you are trying to set the background color of the main menu item to white and that of the child items to black. If thats the case, try out the following code:
C#:
 protected void RadMenu1_PreRender(object sender, EventArgs e) 
    { 
        foreach (RadMenuItem item in RadMenu1.Items)// the main menu items 
        { 
            item.BackColor = System.Drawing.Color.White; 
 
                foreach (RadMenuItem subitem in item.Items)// the child menu items 
                { 
                    subitem.BackColor = System.Drawing.Color.Black; 
 
                }             
        }    
    } 

Thanks
Princy.
0
Kevin Warnke
Top achievements
Rank 1
answered on 07 Apr 2009, 03:11 PM
I was actually after the forecolor but swapping that property out in the code does work.

However, I was hoping for a way to do this within the CSS definition of the Menu so that the change goes along with the custom skin.  Any ideas on what needs to change in the CSS for the Menu skin to do the same thing (change the fore color)?

I've tried a lot of different things to no avail which is why I'm asking.

Thanks,
Kevin
0
Yana
Telerik team
answered on 08 Apr 2009, 11:17 AM
Hello Kevin,

You can use the following css styles to set different color of root items and sub items:

.RadMenu .rmRootGroup .rmLink {  
    colorwhite !important;  
 }  
          
.RadMenu .rmGroup .rmLink {  
    colorblack !important;  
 } 

All the best,
Yana
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Kevin Warnke
Top achievements
Rank 1
answered on 08 Apr 2009, 02:41 PM
Perfect!  That's what I needed.  Thanks!
Kevin
Tags
Menu
Asked by
Kevin Warnke
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Kevin Warnke
Top achievements
Rank 1
Yana
Telerik team
Share this question
or