Thread is closed for posting
2 posts, 0 answers
  1. Josh Kewley
    Josh Kewley avatar
    1 posts
    Member since:
    Sep 2007

    Posted 30 Apr 2013 Link to this post


    I'm wondering how the RadDataBoundListBox knows to apply the DataTemplate named 'FirstCustomHubTileTemplate' to the first item in the list in the Hub Tile 01 sample page. I assume it's a custom converter buried in the Telerik internals. Can you supply the code that applies the template selectively? I'm hoping to apply a custom style declaratively to a ListBoxItem and was hoping I could bind a property rather than create a converter.

  2. Todor
    Todor avatar
    798 posts

    Posted 03 May 2013 Link to this post

    Hi Josh,

    Thank you for contacting us.

    I'm not sure I understand what exactly you need to do. These templates' code is available, so you can see how they use our controls to achieve the desired look. In the mentioned template, we are using the ListHeaderTemplate property to create an item that serves as a header. This item is not part of the collection (you can see that the collection consists of 7 items named from "Title 1" to "Title 7" and the header is an additional item named simply "Title"). Setting this property creates a new ListBoxItem and places it before all other items. If you want to apply a custom style to a specific item from the collection, a better approach is to use the ItemTemplateSelector property and define a selector that applies different templates to the different items. Setting this properties allow to create a different template for the different items and the correct one will be chosen upon their creation. This approach is used in other templates like Thumbnail List 03 (List03.xaml), Image Gallery 02 (Gallery02.xaml) and others. You can see them in the DesignTemplatesShowcase application or by adding the corresponding template to a new project.

    Let me know if you need additional assistance.

    Kind regards,
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Back to Top