This is a migrated thread and some comments may be shown as answers.

PreviewClosed and TextBox TwoWay binding issues

1 Answer 49 Views
Window
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 06 Jun 2011, 07:02 AM
I'm currently using hte PreviewClosed to stop the window from closing by doing something like:
if (.... entities have changes) e.Cancel = true

However, I've recently noticed that TextBox TwoWay bindings do not get updated until AFTER the PreviewClosed is fired. Are there any easy ways to work around this?

1 Answer, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 08 Jun 2011, 07:57 AM
Hi Alex,

You are observing this issue because the focusing mechanism of Silverlight, which TwoWay Bindinding depends on, is asynchronous and the binding is not updated when the event occurs. You could add the following code when the PrviewClose event is fired:

textBox.GetBindingExpression(TextBox.TextProperty).UpdateSource();
It will force the binding to update.

Hope this helps.

Regards,
Miroslav Nedyalkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Window
Asked by
Alex
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Share this question
or