public static MetaMetadata GetMetaMetadata(ElementState that) { if (that is MetaMetadata) { return (MetaMetadata) that; } ElementState parent = that.Parent; return (parent == null) ? null : GetMetaMetadata(parent); }