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

Trying to change RadMenuItem's style based on event...

1 Answer 55 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 24 Nov 2009, 04:48 PM
Hello.  I have a RadMenu with a custom style applied:
<RadNav:RadMenu x:Name="rm" Style="{StaticResource rm}" ItemContainerStyle="{StaticResource rmi1}">  
 
  <RadNav:RadMenuItem x:Name="rmi" ItemContainerStyle="{StaticResource rmi1}">  
    ...
  </RadNav:RadMenuItem> 
 
</RadNav:RadMenu> 
 
 

I also have a button that when clicked will run this code... 
private void btn_Click(object sender, RoutedEventArgs e)  
{  
  this.rm.ItemContainerStyle = App.Current.Resources["rmi2"as Style;  
  this.rmi.ItemContainerStyle = App.Current.Resources["rmi2"as Style;  

I've stepped through the code and it fires and seems to change the style, but the appearance of the RadMenu doesn't change...  Any suggestions as to what I am doing wrong?  (If it matters, my button is inside one of the RadMenuItems.)

 

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 25 Nov 2009, 01:36 PM
Hi Rob,

ItemContainerStyle is applied only if you bind the menu. If you set RadMenuItems (like in the snippet you pasted) ItemContainerStyle won't be applied. In this case set directly RadMenuItem.Style property.

Let us know if you need more information.

Greetings,
Hristo
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Menu
Asked by
Rob
Top achievements
Rank 1
Answers by
Hristo
Telerik team
Share this question
or