WPF Validator and Extra TabStops in SimpleTextBoxWPF Validator and Extra TabStops in SimpleTextBox
Old forum URL: forums.lhotka.net/forums/t/3335.aspx
GlennMiller posted on Monday, August 06, 2007
We are not sure if this is a CSLA thing. But, we are using CSLA 3.0 release. Here is what happens:
We have a Business Rule in CSLA that states "OurField" can't be blank (null).
On our WPF Form we have a SimpleTextBox
Clear out the text in the textbox bound to "OurField".
Red error box appears around "OurField" textbox.
Then start tabbing around in the WPF Form. What you will see is when tabbing comes back around to that "OurField" textbox the red box has a tabstop / focus (thus to get out of the textbox will require two tabs rather than one)! We have tried to replicate this issue without CSLA and can't. So we are thinking it's a CSLA issue. Could it be a problem in the Decorator Base class that the Validator class uses?
We are using a Default SimpleStyle for TextBox and we are not defining any custom templates for how the red error validation box works. All defaults.
Here is the XAML Structure of our WPF Form (this is a small window with only a few bound controls)
UserControl->Validator->Grid->TextBox (Style is SimpleTextBox)
Does anyone have any ideas?
GlennMiller replied on Tuesday, August 07, 2007
We have a work-around of sorts. If you put this on the outermost
Grid that you have:
KeyboardNavigation.TabNavigation="Cycle"
it seems to fix it.
What this does is constrains the tabstop to just the
controls in the grid. We think that this extra tabstop, around the error
validation box, is in 'outerspace'. Thus putting that line in XAML masks the problem.
The extra tabstop is still there. But the user won't know it.
I am still curious as to why this is an issue?
RockfordLhotka replied on Tuesday, August 07, 2007
This doesn't happen to me. But if you are applying an explicit style, then you may be changing the visual tree when the control is in error - adding something in there that can and does accept the focus.Copyright (c) Marimer LLC