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 170135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:45:16+00:00 2026-05-11T12:45:16+00:00

Lets say I have this: public class Result { public bool Success { get;

  • 0

Lets say I have this:

public class Result  {    public bool Success { get; set; }    public string Description { get; set; } } 

Then I want to add another level, like this:

public class AssertionFailedResult : Result {   public string Expected { get; set; }   public string Actual { get; set; } } 

In WPF, how would I show the simple result one way and the assertion failed result another way? I’d like to basically make a template based on type.

  • 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. 2026-05-11T12:45:17+00:00Added an answer on May 11, 2026 at 12:45 pm

    If you create a DataTemplate in a resource dictionary and set the DataType property, but don’t set the x:Key property, the framework will associate the DataTemplate to objects based on the object’s runtime type. For better or worse, inheritance has no effect. In other words, even if you didn’t have a template where the DataType was ‘AssertionFailedResult’, the framework would not bind objects of type ‘AssertionFailedResult’ to a template where the DataType was ‘Result’.

    EDIT: Sorry, I got it backwards. DataTemplates do have a ‘polymorphic’ behavior. Styles do not. In any case, the frameworks should bind to the DataTemplate with the more specific DataType.

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

Sidebar

Related Questions

Lets say i have this usercontrol public class test : UserControl { public int
Lets say have this immutable record type: public class Record { public Record(int x,
lets say I have my owndefined datatype like this: public class InformationType { private
Lets say I have this code: public void MyMethod(string Data, List<string> InputData) { //I
Lets say I have this class in foobar-shared.lib: class FooBar { std::string m_helloWorld; }
Let's say we have this class: public class Moo { string _value; public Moo(string
Lets say I have this amputated Person class: class Person { public int Age
Let's say I have: public class Fruit { public static List<String> Suppliers { get;
Let's say I have this entity (for Hibernate): @Entity public class Person { @Id
Let's say I have some model objects that resemble this: public class FooModel {

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.