0
votes

I am writing a control in WPF that draws a shape on a form and then draws dimensions of this shape. These dimensions are editable so they are shown in a text box. When the user changes a dimension in a text box the shape is updated.

I am updating the shape when the textbox showing the dimension loses focus i.e. as soon as the text box loses the focus the shape and all the dimensions are redrawn. A text box loses focus in one of two ways - either when user presses tab key or when user clicks in another control outside the text box.

My problem is that when user presses tab key or clicks somewhere else outside the text box the whole control is redrawn and the focus is not set to the next control where it should be. This is really annoying because tabs stop working altogether and to set a focus using mouse the user has to click twice. Is there a way around this?

An image of my control is shown below

alt text http://img223.imageshack.us/img223/9496/cavity.png

1
You can change functionality a bit, like when user types in any textboxes at that time you can change the dimension i.e. OnTextChanged event, so user doesn't have to do some additional click to update the dimension. And you can move between textboxes using tab keys.Palak.Maheria

1 Answers

1
votes

It seems that you want to manage the tab order yourself in this window and to do that, I'd think you would subscribe to the GotKeyboardFocus and LostKeyboardFocus events on those edit fields and then drive focus to the appropriate location if you're not happy with where focus has gone.