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

FirstCustomHubTileTemplate

1 Answer 39 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Josh Kewley
Top achievements
Rank 1
Josh Kewley asked on 30 Apr 2013, 07:52 PM
Hi,

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.

Thanks

1 Answer, 1 is accepted

Sort by
0
Todor
Telerik team
answered on 03 May 2013, 10:02 AM
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,
Todor
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.
Tags
DataBoundListBox
Asked by
Josh Kewley
Top achievements
Rank 1
Answers by
Todor
Telerik team
Share this question
or