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

ItemTemplateSelector with Resource Dictionary

1 Answer 103 Views
ListView
This is a migrated thread and some comments may be shown as answers.
IanV
Top achievements
Rank 1
Veteran
IanV asked on 08 Jan 2019, 06:53 PM

I have a nicely working ItemTemplateSelector

 

<telerikDataControls:RadListView.ItemTemplateSelector>
 
  <vm:HotlistItemSelector>
 
     <vm:HotlistItemSelector.ErrorTemplate>
 
          <DataTemplate>
 
               My template here

I wish to reuse my ErrorTemplate. I have placed it in a ResourceDictionary. How can I tell my  HotlistItemSelector that the ErrorTemplate is to be found in the ResourceDictionary ?

 

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Lance | Senior Manager Technical Support
Telerik team
answered on 08 Jan 2019, 10:03 PM
Hi Ian,

An expanded property in XAML can almost always be defined in-line, this is especially true when the object is defined as a ResourceDictionary resource.

Let's say your DataTemplate is this:

<ResourceDictionary>
    <DataTemplate x:Key="MyErrorTemplate">
        ...
    </DataTemplate>
</ResourceDictinary>


Then you'd do this:

<telerikDataControls:RadListView.ItemTemplateSelector>
  <vm:HotlistItemSelector ErrorTemplate="{StaticResource MyErrorTemplate}">
</telerikDataControls:RadListView.ItemTemplateSelector>

Let me know if you have any further trouble.

Regards,
Lance | Tech Support Engineer, Sr.
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
ListView
Asked by
IanV
Top achievements
Rank 1
Veteran
Answers by
Lance | Senior Manager Technical Support
Telerik team
Share this question
or