Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 467195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:33:22+00:00 2026-05-12T23:33:22+00:00

I defined in XAML DataTemplate for my own type. <DataTemplate DataType={x:Type MyType}> … </DataTemplate>

  • 0

I defined in XAML DataTemplate for my own type.

<DataTemplate DataType="{x:Type MyType}">
    ...
</DataTemplate>

Now I want to add one more template for the same type in the same scope. How would I choose then which of templates to use in concrete ItemsControl?

Background:
I have ItemsControl that displays objects of different types (derived from one base class of course) in different way depending on the item’s type. So I’ve specified unnamed data templates for each type. Now I need to show the same data but with new templates (old templates supported editing, new ones – not).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:33:23+00:00Added an answer on May 12, 2026 at 11:33 pm

    you would need to use DataTemplateSelector (msdn link)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following xaml code in resources: <DataTemplate DataType={x:Type s:Substance}> <StackPanel Orientation=Horizontal> <TextBlock
I have a DataTemplate defined in a xaml file that I want to access
I have a WPF ListBox with a defined DataTemplate. In that template, I have
I want to set an Attribute to a Property, which is defined in Xaml.
Suppose the following XAML defined window: <Window x:Class=LayoutTests.Window1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:local=clr-namespace:LayoutTests Title=Window1> <Window.Resources> <XmlDataProvider
I have a listbox defined in XAML as: <ListBox x:Name=directoryList MinHeight=100 Grid.Row=0 ItemsSource={Binding Path=SelectedDirectories}/>
If i have a storyboard animation defined in xaml resources, how do i go
I would like to bind a TreeView control I have defined in XAML to
I have a xaml grid defined as: <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="150"/> <ColumnDefinition/> </Grid.ColumnDefinitions> </Grid>
I defined a record named log . I want to create an mnesia table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.