Does the XAML Parser not understand interface inheritance?
10:52 26 Aug 2025

If in XAML, I cast an object to an interface B which derives from interface A, the XAML parser does not appear to understand the inheritance. Am I doing something wrong?

Here are my interfaces

public interface IMovable          { bool IsMovable { get; set; } }
public interface IShape : IMovable { bool IsDragLimited { get; } }

And I have this style which casts an object to the derived interface IShape but uses a property from the base interface, IMovable


The problem is that this code causes a XAML excxeption which tells me the following

InvalidOperationException: Property path is not valid. 'IShape' does not have a public property named 'IsMovable'.

That's technically true but ISHape derives from IMovable which does have that property. If I change my XAML to instead cast the object to IMovable, then I do not get the exception.

I guess you could say, "Then just cast it to IMovable". But I'm trying to understand this so I don't make similar mistakes in the future: why does this work for objects and interfaces?

wpf xaml casting