I get runtime error when I do this.
I have this class:
public abstract class AnnObject : DependencyObject
and when I do this it compiles fine, but throws a runtime error...
AnnObject aa;
var b = (DependencyObject)aa;
var c = (UIElement)b;
The error I get is cannot cast AnnObject to UIElement
.
Can someone please briefly explain this behaviour?