Which is the default itemtemplate?

4 posts, 0 answers
  1. Paolo
    Paolo avatar
    423 posts
    Member since:
    Jun 2009

    Posted 19 Dec 2011 Link to this post

    Hello,
    I'm tring to use MVVM pattern with RadMenu,I'm almost at... but I'm not able to extract with blend the default itemtemplate for RadMenuItem's itemtemplate.... can someone post it please?
    Thanks
  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 20 Dec 2011 Link to this post

    Hi Paolo,

    There are four types of RadMenuItems and a control template for each of them - TopLevelHeaderTemplate, TopLevelItemTemplate, SubMenuHeaderTemplate, SubMenuitemTemplate. You can get the whole style of the RadMenu from your installation folder, for example: C:\Program Files (x86)\Telerik\RadControls for WPF Q3 2011\Themes\Transparent\Themes\Transparent\Menu.xaml

    Hope this helps.

    Best wishes,
    Konstantina
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Paolo
    Paolo avatar
    423 posts
    Member since:
    Jun 2009

    Posted 22 Dec 2011 Link to this post

    Hello Konstantina,I've got the following item in my ViewModel :

    public class MenuItemObject : Screen//, ICollection<MenuItemObject>
       {
           public int ID { get; set; }
           public string Descrizione { get; set; }
           public string Tag { get; set; }
           public List<MenuItemObject> Items { get; set; }
     
           public MenuItemObject()
           {
               Items = new List<MenuItemObject>();
           }
       }

    If I've no child item I can see them in my Caliburn Micro pattern Menu.... if there're I can't... it's possible to have an MVVM pattern example? should I need to define an ItemTemplateSelector and based on the presence of child item show a type instead of another?
    Thanks
    Paolo
  5. Dani
    Admin
    Dani avatar
    848 posts

    Posted 27 Dec 2011 Link to this post

    Hello Paolo,

    You do not need to use a selector and manually apply an item template depending on whether your MenuItem has submenu items or not. RadMenu takes care of this automatically.

    If you need to use only the default template for RadMenuItem, you can copy the SubMenuItemTemplate and customize it per your requirements.

    If your menu ever includes hierarchical items, you will need all four templates for your changes to get applied. I suggest that you use the implicit RadMenuItem style found in the suggested location on your machine and apply it as an ItemContainerStyle including all four templates that it has a reference to.

    Hope this helps.

    All the best,
    Dani
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Back to Top