Databinding C# issue with setting and retaining data in the databind
I have a databound textbox. When I change the text via the text Property it automatically updates the textbox but when closing out of the window and relaunching the databinding goes back to the old data. The text box is read only so I did one way binding. How do I fix the issue of the data not binding co开发者_开发百科rrectly?
Ideally you should be changing the underlying object data, versus the Text
property of the TextBox
on a read-only TextBox
control.
If you want to continue using the Text
property you will need to set your binding as TwoWay
.
<TextBlock Name="MyTextBox" Text="{Binding Path=PropertyName, Mode=TwoWay}"/>
精彩评论