This project has moved. For the latest updates, please go here.

maskedtexbox vs. validation

Jan 7 at 11:09 AM
hi,

i have a validation problem and maybe i am to blind to see the solution. (

i wanna check/validate a BIC(Bank Identifier Code) number. therefore i use the INotifyDataErrorInfo interface and System.ComponentModel.DataAnnotations.
that works very well but i thought a masked text box is sometimes a good idea, like in my case with the BIC.
BUT it is senseless to use it when i not get a validation error from the controll when the mask is invalid. i have no idea how, because my validation only work with the binded values. :/
[Required(ErrorMessageResourceType = typeof(Properties.Resources), ErrorMessageResourceName = "BicRequired")]
[StringLength(11, ErrorMessageResourceType = typeof(Properties.Resources), ErrorMessageResourceName = "BicLength")]
public string Bic
        {
            get
            {
                return(this.__dataModel.Bic);
            }
            set
            {
                if (this.__dataModel.Bic!= value)
                {
                    this.__dataModel.Bic= value;
                    this.RaisePropertyChanged("Bic");
                    Log.Logger.DebugFormat("{0}:{1} - set('{2}')", this.FullName, MethodBase.GetCurrentMethod().Name, (value == null) ? "NULL" : value);
                }
            }
        }
<xctk:MaskedTextBox Mask=">LLLL LL AA aa"
  PromptChar="-"
  AllowPromptAsInput="False"
  AutoSelectBehavior="OnFocus"
  ResetOnPrompt="True"
  ResetOnSpace="True"
  Value="{Binding Path=CartaxBic, FallbackValue='', TargetNullValue='', ValidatesOnNotifyDataErrors=True, UpdateSourceTrigger=PropertyChanged}"
  ValueDataType="{x:Type s:String}" 
  />