开发者

Retain content on Page1 after navigating to Page2 and back to Page1 in WPF

开发者 https://www.devze.com 2023-01-17 18:31 出处:网络
On Page1 I have a TextBox, ComboBox and Hyperlink control. The TextBox has a value \"ABC\" and the ComboBox has a value \"123\".

On Page1 I have a TextBox, ComboBox and Hyperlink control. The TextBox has a value "ABC" and the ComboBox has a value "123".

When I click on the Hyperlink on Page1 I navigate to Page2.

On Page2 I click on a back Button which takes me back to Page1.

I can actually see my values. However I cannot see the values when the controls on Page1 are bound to a data source.

If I have XAML like this:

<TextBox: x:Name="txtName" Text="{Binding Path = uName}" />

then in the Page1 navigation to Page2 and back it is not retaining the values in the TextBox and ComboBox.

Is this some kind of intended behavio开发者_如何学JAVAur or a bug?


Have you remembered to set KeepAlive="True" in Page1 XAML?

0

精彩评论

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

关注公众号