RadMenu MVVM style/template selectors

3 posts, 0 answers
  1. SB
    SB avatar
    2 posts
    Member since:
    Apr 2016

    Posted 27 Oct Link to this post

    I have been looking through the Telerik RadMenu WPF demos and found the Customization_MVVM_WPF demo.I have a couple of questions with regard to this demo that I hope someone can help me with.

    Question:
    The MVVM demo has a class "MenuItemContainerTemplateSelector" that does not appear to be used by the demo. I can see that the 'MenuItemStyleSelector' class is used, but am curious when to use the MenuItemContainerTemplateSelector as opposed to the MenuItemStyleSelector? Is there a demo where this MenuItemCoontainerTemplateSelector class is used which I can take a look at the implementation?

     

    What I am trying to accomplish:

    I need to create a RadMenu which dynamically binds to a collection of ViewModels (RadMenuItems) and uses DataTemplates or styles to tell 'how' to display each of the ViewModels. Are there examples demonstrating this which I have not yet found? The Customization_MVVM_WPF demo somewhat covers this, but attempting to move the MenuItemsSource in this demo out of the XAML and into a collection of ViewModels which the RadMenu binds to seems to not work.

  2. Stefan X1
    Admin
    Stefan X1 avatar
    517 posts

    Posted 01 Nov Link to this post

    Hi Sedric,

    Generally speaking, this topic is discussed in the Template and Style Selectors article. Can you please check it out? As to determining when to use a template or a style selector, this depends on whether you need to modify the default appearance of the control, or you need to specify custom element in the predefined template. More information can be found in the following resources:

    - DataTemplateSelector
    - StyleSelector

    Hopefully, this clarifies your concerns.

    Regards,
    Stefan X1
    Telerik by Progress
    Do you need help with upgrading your WPF project? Try the Telerik API Analyzer and share your thoughts!
  3. UI for WPF is Visual Studio 2017 Ready
  4. SB
    SB avatar
    2 posts
    Member since:
    Apr 2016

    Posted 3 days ago in reply to Stefan X1 Link to this post

    Thank you for the reply.

    I was hoping for an example that uses the "MenuItemContainerTemplateSelector" class found in the Customization_MVVM_WPF demo. Also, it would be ideal if the example would have the menu items bound to view models rather than declared in the xaml.

     

Back to Top