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

A problem with ContentTemplateSelector

2 Answers 104 Views
TileView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
M
Top achievements
Rank 1
M asked on 16 Jul 2012, 07:49 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
Zarko
Telerik team
answered on 18 Jul 2012, 08:32 AM
Hi M,
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 (you'll have to use a converter).
I've attached a sample project so could you please examine it and if you have further questions feel free to ask.

Regards,
Zarko
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:25 AM
Thanks
Your reply is really helpful.
Regards,
M
Tags
TileView
Asked by
M
Top achievements
Rank 1
Answers by
Zarko
Telerik team
M
Top achievements
Rank 1
Share this question
or