private void InsertStyleProperty() { if (!StyleName.IsNotNullOrEmpty() || HasStyleSet != false) { return; } var newAttribute = Document.CreateAttribute("Style"); newAttribute.Value = string.Format("{{StaticResource {0}}}", StyleName); Document.ChildNodes[0].Attributes.Append(newAttribute); }