Styling a Databound menu

2 posts, 0 answers
  1. Mat Guthrie
    Mat Guthrie avatar
    8 posts
    Member since:
    May 2010

    Posted 31 Jan 2011 Link to this post


    Please excuse my ignorance but I'm just beginning to do battle with WPF styling / Templates etc.

    I'm trying to style up a RadMenu that is databound and uses the  HierarchicalDataTemplate. I'd like to have the header row menu items styled differently to the child items, including font sizes, mouseover colors / animations etc. The examples contained in the documentation seem to be very limited, showing only the most basic of style setters and no examples of selecting different styles based on the type of menu item (header item or child). Can anyone provide me with a more complete example of radically changing the styling of a RadMenu as described above?

    Many thanks

  2. Pana
    Pana avatar
    748 posts

    Posted 03 Feb 2011 Link to this post

    Hello Mat Guthrie,

    Have you checked this example:
    It uses StyleSelector to set different styles for the different menu items. Note that in the SelectTemplate method you will have parameters for both the RadMenuItem and the item that comes from the ItemsSource. You can cast them and use their properties to specify what templates the RadMenuItems will use (this includes whether the item is top or sub level).

    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top