static void OnTextChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            XmlEditor me = sender as XmlEditor;

            if (me != null && me.Content != null && me.Content.Document != null)
            {
                me.Content.Document.Text = me.Text;
            }
        }
 private EditorWindow(XmlEditor editorControl)
 {
     if (editorControl == null)
     {
         Editor = new XmlEditor();
     }
     else
     {
         Editor = editorControl;
     }
     LoadCommandBindings();
     InitializeComponent();
 }
        static void OnErrorsChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            XmlEditor me = sender as XmlEditor;

            if (me != null)
            {
                me.ErrorList = new ObservableCollection <string>();
                string[] err = me.Errors.Split('\r');
                foreach (string eo in err)
                {
                    if (!string.IsNullOrEmpty(eo.Replace("\n", string.Empty).Trim()))
                    {
                        me.ErrorList.Add(eo.Replace("\n", string.Empty).Trim());
                    }
                }
            }
        }
        public static void Show(string title, string file)
        {
            XmlEditor xe = null;

            try
            {
                xe = new XmlEditor();

                Show(title, file, xe, null, null);
                xe = null;
            }
            finally
            {
                if (xe != null)
                {
                    xe.Dispose();
                }
            }
        }
        public static void Show(string title, string file, XmlEditor editorControl, Control sideElement, ImageSource Icon)
        {
            EditorWindow win = new EditorWindow(editorControl);

            if (Icon != null)
            {
                win.Icon = Icon;
            }
            if (!string.IsNullOrEmpty(title))
            {
                win.Title = title;
            }
            win.SideElement = sideElement;
            if (!string.IsNullOrEmpty(file) && System.IO.File.Exists(file))
            {
                win.Load(file);
            }

            win.AdditionalButtons = ButtonContent;
            ButtonContent         = null;
            win.Show();
        }
 /// <summary>
 /// Shows the specified title. Must inherit XmlEditor.
 /// </summary>
 /// <param name="title">The title.</param>
 /// <param name="editorControl">The editor control.</param>
 public static void Show(string title, XmlEditor editorControl)
 {
     Show(title, null, editorControl, null, null);
 }
 /// <summary>
 /// Shows the specified editor control. Must inherit XmlEditor.
 /// </summary>
 /// <param name="editorControl">The editor control.</param>
 public static void Show(XmlEditor editorControl)
 {
     Show(null, null, editorControl, null, null);
 }