views:

157

answers:

1

Hey there,

In Windows Phone 7 (Silverlight), when I use the back button to return to the previous page, the page title does not update and remains the same as the page that was just left. The actual text is bound to a string in a viewmodel, nothing special there. Here is the line of xaml.

<TextBlock x:Name="CategoryPageTitle" Text="{Binding Title, Mode=OneWay}" Margin="-3,-8,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>

I also have a simple listbox with an event that fires when you select one of its entries. The problem is that if you navigate back to this page, the previously selected entry remains selected, so that you cannot, for example, immediately click the same entry again to fire the same event.

Does anyone know a way around either of these? Thanks!

+1  A: 

This is really two questions, but I'll try to tackle them both.

Do both of your views have a Title set?

The navigation service keeps the previous page in the same state it was in when you navigated away. If you want the listbox to clear selection, you can write some code to do so in your view's code-behind.

protected override void OnNavigatedTo(NavigationEventArgs e)
{
    MyListBox.SelectedItem = null;
}
Matt Casto
Both do have a title set, in the exact same fashion as the code above. Does that help?Your suggestion for the second problem was helpful however, I didn't think of doing something like that.
Will