ItemTemplateSelector with Resource Dictionary

2 posts, 1 answers
  1. IanV
    IanV avatar
    39 posts
    Member since:
    Dec 2008

    Posted 08 Jan 2019 Link to this post

    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 ?

     

     

  2. Answer
    Lance | Manager Technical Support
    Admin
    Lance | Manager Technical Support avatar
    1168 posts

    Posted 08 Jan 2019 Link to this post

    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
Back to Top