I currently have a RadMenu with a static top-level RadMenuItem, which in turn contains a dynamically-populated submenu. What I'm trying to do is change each dynamic RadMenuItem's Foreground brush at runtime, but I'm not able to access the submenu's RadMenuItems until the user has hovered over the static RadMenuItem, causing the submenu to be drawn.
Here is the structure:
* RadMenuItem (static; Header = "Products"; ItemsSource = bound to a collection of business entities)
* dynamic submenu
* RadMenuItem (dynamic; Header = "Product 1 Name")
* RadMenuItem (dynamic; Header = "Product 2 Name")
* RadMenuItem (dynamic; Header = "Product 3 Name")
I have been playing around with various methods over the past few weeks, and the only way I have found to reliably change a static
submenu RadMenuItem's Foreground brush is to set it directly:
.MyStaticRadMenuItem.Foreground = aBrushWithDifferentColor;
However, this presents a problem: I am unable to access the dynamic submenu RadMenuItems until after the submenu has been shown for the first time (in other words, it looks like the RadMenuItems aren't created until the first time the user displays the submenu).
Is there a way to force the static RadMenuItem to create its dynamic submenu RadMenuItems without waiting for the user to display the menu?