wpf - TwoWay binding doesn't update controls -
the simplest example think of following:
textbox tb1 = new textbox(); textbox tb2 = new textbox(); this.content = new stackpanel() { children = { tb1, tb2 } }; binding binding = new binding("text") { mode = bindingmode.twoway, source = tb1, updatesourcetrigger = updatesourcetrigger.propertychanged }; tb2.setbinding(textblock.textproperty, binding);
when start application expect textboxes update text other textbox's text changes. neither source textbox nor target textbox updates text when changing other textbox. is there reason strange behavior , might there workaround?
(for specific reasons cannot use xaml, bindings worked me)
update: when changing text of 1 of textboxes first time, output window says the thread 0x#### has exited code 259 (0x103).
you're using wrong dependencyproperty
.
tb2.setbinding(**textblock**.textproperty, binding);
copied code works expected when using textbox.textproperty
Comments
Post a Comment