private static void SetupAndValidate(TextBox textBox)
        {
            TextBoxFormatValidationHandler handler;

            if ((handler = GetFormatValidationHandler(textBox)) == null)
            {
                handler = new TextBoxFormatValidationHandler();
                SetFormatValidationHandler(textBox, handler);
            }
            else
            {
                handler.Validate();
            }
        }
 /// <summary>
 /// Sets the FormatValidationHandler property. This dependency property
 /// indicates the handler that checks the format in the TextBox.
 /// </summary>
 public static void SetFormatValidationHandler(DependencyObject d, TextBoxFormatValidationHandler value)
 {
     d.SetValue(FormatValidationHandlerProperty, value);
 }