开发者

Databinding C# issue with setting and retaining data in the databind

开发者 https://www.devze.com 2023-04-13 07:41 出处:网络
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 da

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}"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消