views:

472

answers:

0

I have written a custom UserControl that is embedded into another UserControl. Something like the simple diagram below.

UserControl_A UserControl_B TextBox_1 CheckBox_1 Button_Save

In UserControl-B the validation is working reasonably well but I want to check for errors in the logic of UserControl-A ( OnSaveClick event of the ButtonSave ).

It is easy enough for me to expose a method on UserControl-B that checks TextBox-1 and CheckBox-1:

protected bool HasErrors
{
   bool result = false;
   result &= Validation.GetHasError( TextBox_1 );
   result &= Validation.GetHasError( CheckBox_1 );
   return result;
}

It would be more handy, however, if I could figure out how to expose the attached property of Validation.GetHasError on UserControl_B. I have no earthly idea on how to accomplish this. Any clues out there?