Fixed so markup extensions where property is set by a StaticResource checks if the referenced resource is declared locally, and it its declared locally it forces the markup extension to be printed as element and not as shorthand XAML markup extension code. This is so the StaticResource can find the correct resource.
Also fixed so Resources element is always left first among the child elements when inserting new child.