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

A problem with ContentTemplateSelector

2 Answers 106 Views
TileView
This is a migrated thread and some comments may be shown as answers.
M
Top achievements
Rank 1
M asked on 17 Jul 2012, 04:02 AM
Hi there,
I have bound the ItemsSource property of RadTileView to an ObservableCollection containing items with INotifyPropertyChanged interface implementation, and also I am using a ContentTemplateSelector that determines the template for the content of TileViewItems based on a property of the corresponding item named "Template".
The first time the RadTileView loads, it calls the template selector and sets the templates correctly, but if I change the "Template" property of any item in items source bound collection, the RadTileView does not call the template selector to determine the appropriate template again. It needs to set the ItemsSource of the RadTileView again to reflect the changes.
Is ther any solution to avoid setting the ItemsSource property every time I change the "Template" property of bound items?
Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Tina Stancheva
Telerik team
answered on 19 Jul 2012, 08:38 AM
Hi,

We've already replied to the forum thread you started for Silverlight. However, I will paste the same reply here as the approach can be used in both frameworks:

The problem in your case is that the ContentTemplateSelector is called only when the containers are generated (this is the default behavior of all selectors) and that's why it's not triggered on property change. If you want to be able to change the ContentTemplate runtime you'll have to bind the ContentTemplate property of the RadTileViewItem to the Template property in your business object and use a converter.

Kind regards,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
M
Top achievements
Rank 1
answered on 21 Jul 2012, 11:29 AM
Thanks Tina
Your answer is really helpful
Regards,
M
Tags
TileView
Asked by
M
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
M
Top achievements
Rank 1
Share this question
or