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

2 posts, 0 answers
  1. Rob
    Rob avatar
    238 posts
    Member since:
    Jan 2009

    Posted 24 Nov 2009 Link to this post

    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}">  

    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.)


  2. Hristo
    Hristo avatar
    832 posts

    Posted 25 Nov 2009 Link to this post

    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.

    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.
  3. DevCraft banner
Back to Top