views:

77

answers:

1

I have a textbox that is bound (oneway) to a datatable that updates a couple of time a second. So the textbox value continually reflects changes in datatable. When I enter the textbox to manually set a value, the binding causes the value to continually be overwritten. How do I stop this? When I have entred a value (textbox lost focus) I want the textbox to return to display the bound value and not the value I have just entered manually.

+1  A: 

You could attach to the text input event and cancel the binding and then reapply it on the lost focus event.

I think however you need to consider why you are displaying your bound value in a text box at all? Would it not be more appropriate to have an uneditable Textblock displaying your database information with the editable Textbox separate for the optional user input.

While what you are asking is doable using the Textbox event I mentioned, it seems like it would be confusing from a user perspective.

Lozzey
I know what events I need to put the code in !!!!!I do not know how to programatically switch binding off and back on.
Adam
+1 - it does sound like a muddled UI, best fixed by taking a combined textblock and textbox approach.
slugster