views:

255

answers:

1

As we all know, we can't use DataTemplates with Interfaces, but apparently (old question) we can use abstract classes.

Why?

The multiple inheritance argument goes for abstract classes as well...

A: 

The old question you refer to still applies the data template to the concrete class. You will have the same problem if you try applying the data template to the abstract class. Nothing prevents you from using interfaces - you just have to associate the data template with a concrete implementation of that interface.

The problem is essentially that WPF uses the runtime type to resolve a template.

HTH, Kent

Kent Boogaart
I don't seem to understand you, but this<DataTemplate DataType="{x:Type local:SomeClassBase}">Looks like he uses the abstract base class...
Hades32
I just tried this, and it works. Evidently WPF supports traversal of a class hierarchy, but will not look at interfaces
Jerry Bullard