Catel.usercontrol automatically generates a WarningAndErrorValidator

May 22, 2012 at 9:58 AM
Edited May 22, 2012 at 9:58 AM

Hi Geert

When trying to resolve a userfriendly taborder in our application, I stumbled upon the WarningAndErrorValidator. When putting a usercontrol in another usercontrol, tabbing causes the WarningAndErrorValidator to get focus (unnoticeable) and also interrupt the tab flow.

After some debugging, it came to my attention that a default WarningAndErrorValidator is created when making a catel:Usercontrol. This is not noticeable in Xaml, but peeking while debugging learned me that the WarningAndErrorValidator is a child of a grid under the usercontrol. So in fact, the grid that gets the "LayoutRoot" name by default isn't actually the layoutroot, but resides as a sibling of WarningAndErrorValidator and under another Grid (also not noticeable in Xaml).

I've disabled the tabbing behavior for the WarningAndErrorValidator by using this line of code in the loaded event of the usercontrol:


CType(CType(Me.Content, System.Windows.Controls.Grid).Children(0), Catel.Windows.Controls.WarningAndErrorValidator).IsTabStop = False

I've read previous discussions saying you can manually add WarningAndErrorValidators if it is needed. So I'd just like to know why there is a default WarningAndErrorValidator in the usercontrol?

Thanks in advance.

May 22, 2012 at 11:33 AM

By default, it creates a WarningAndErrorValidator. For now there is no option not to create one. We can build this, you are free to create a work item for it.

I will disable the tab stop (since the InfoBarMessageControl shouldn't receive a tab stop).

May 22, 2012 at 12:05 PM

We don't have the need to disable the creation of a WarningAndErrorValidator, I was just curious if my assumptions were correct.

Disabling the tab stop is already great for our needs.

Thank you for your answer.

May 22, 2012 at 12:22 PM

Ok, just checked in the fix.