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

Nested use of ItemTemplateSelector

1 Answer 82 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 22 Jun 2017, 12:56 PM

I have an object with a list of sub-objects, each of which can be a different type. These sub objects will then have a list of sub-sub-objects, which also will have different types, and I'd like them all to have different template in my tree view (to allow for different context menus, etc.)

Essentially, I'm looking to have:

- GlobalType (which contains a list of ISubType)

     - SubType1 (Which contains a list of ISubSubType)

          -SubSubType1

          -SubSubType2

    - SubType2 (Which contains a list of ISubSubType)

          -SubSubType3

          -SubSubType4

 

If I have my ItemTemplateSelector for the TreeView properly defined (i.e, for each of GlobalType, SubType1, SubType2, SubSubType1, ...), will it properly set the templates for the nested items?

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 27 Jun 2017, 11:38 AM
Hello Rob,

Yes, you can use the ItemTemplateSelector property of RadGridView and the DataTemplates will be set to the corresponding items. For more information you can see the ItemTemplateSelector article. Check also the attached project.

Regards,
Martin Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
TreeView
Asked by
Rob
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or