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

  • Home
  • SEARCH
  • 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 amputated Person class: class Person { public int Age
Lets say i have this entity public class Address : Entity { public Address()
Lets say I have a two classes like this: public class LocalResources { public
Lets say i have the following scenario: public class A { public String createString(final
Let's say I have data structures that're something like this: Public Class AttendenceRecord Public
So lets say I have this interface: public interface IBox { public void setSize(int
Lets say I have an array like this: string [] Filelist = ... I
Lets say I have a string COLIN. The numeric value of this string would
Lets say I have a library, version 1.0.0, with the following contents: public class
So say I have this class: public class PositionList { private Position[] data =

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.