Djordje
February 21, 2024, 1:01pm
1
I tried to change the background color on a panel menu. Firstly I simply add style to the Panel menu item and it works but when I tried to the second level of Panel menu item to do the same nothing happens. Only result I achieve is that sub menus of that particular panel menu item is surrounded by this background color I defined.
So, how to set background color for sub menu items?
Thanks in advance.
korchev
February 21, 2024, 4:26pm
2
You can use a CSS variable to set the background color of sub menu items:
<RadzenPanelMenu Style="--rz-panel-menu-item-background-color: red">
Djordje
February 22, 2024, 11:50am
3
Thank you Atanas. Indeed it works but unfortunately only for the first level of the submenu, on the second level it does not work.
korchev
February 22, 2024, 12:21pm
4
It actually works for the second level as can be seen from my screenshot For the first level you can set the background of the RadzePanelMenu itself.
Djordje
February 22, 2024, 12:35pm
5
My bad. I thought about the second and third levels. Sorry for my ANSI C mind, I am starting from level zero.
Hi @Djordje ,
These are the available background CSS variables:
:root {
--rz-panel-menu-background-color: green; /* Root level items */
--rz-panel-menu-item-background-color: red; /* First level child items */
--rz-panel-menu-item-2nd-level-background-color: yellow; /* Second level child items */
}
For everything beyond these a custom CSS is needed cascading through different levels, e.g:
.rz-panel-menu .rz-navigation-menu .rz-navigation-menu .rz-navigation-menu .rz-navigation-item-wrapper {
background-color: purple !important;
}
.rz-panel-menu .rz-navigation-menu .rz-navigation-menu .rz-navigation-menu .rz-navigation-menu .rz-navigation-item-wrapper {
background-color: pink !important;
}
I agree these are not that intuitive and most probably will be revised with a next major version of Radzen Blazor Components.
Djordje
February 22, 2024, 5:05pm
7
Thank you again. It works and 3 level is deep enough.