protected override void OnClosing(CancelEventArgs e)
        {
            TextBoxName.GetBindingExpression(TextBox.TextProperty).UpdateSource();
            bool hasError = (bool)TextBoxName.GetValue(Validation.HasErrorProperty);

            if (this.DialogResult == true && hasError)
            {
                MessageBox.Show("There are still errors, cannot close");
                e.Cancel = true;
            }
        }