tags:

views:

13

answers:

1

Hi

I have an app which uses the navigation window. THe page is designed this way.

<Page>
 <Grid>
   <ComboBox/> <TextBox/>
   <Grid> <TextBox/> </Grid>
   <Grid> <TextBox/> </Grid>
   <ListBox/>
 </Grid>
</Page>

Now when i click a "new", i create a page,

Page1 pg1 = new Page1();
this.NavigationService.Navigate(pg1);

Now when i come back to the previous page, i lose the items in the listbox and the text in those two textboxes within the grid. The text in the combobox and textbox remains as selected/typed. How do i keep the data in the page as it is?

Thanks

+1  A: 

WPF unloads its controls if they are not visible. I am guessing that the items in your listboxes and textboxes are not bound to anything so they get reset when the controls get reloaded.

Best way to avoid that is to bind them to something in the code behind so that they maintain their data.

Rachel
Actually i was tying the source of Navigation window to a page. So that page alone lost its data. When i used a frame inside a window, and created pages within that frame, i dont see any problem retaing the data. http://msdn.microsoft.com/en-us/library/ms750478.aspx#RetainingContentStateWithNavigationHistory