The windows phone 7 XAML page is only refreshed when the item is first deleted, not after

I am currently developing a Windows Phone 7 app for assignment.

I have a page that displays a list of rooms with carpet / name area / cost. When you click on a room, it removes that room from the database and refreshes the page. This works fine for the first click; it removes it and updates beautifully. However, when you click on another room, it does not refresh the page, although it removes it from the database. It's a simple problem, but I can't figure it out at all.

Here is the changed selection event

private void roomListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var room = roomListBox.SelectedItem as Room;

            viewModel.DeleteRoom(room);

            NavigationService.Navigate(new Uri("/RoomList.xaml?Refresh = true", UriKind.Relative));
    }

      

and room delete function

internal void DeleteRoom(Room deletedRoom)
        {
            var qry = from r in roomDb.Rooms
                      where r.Id == deletedRoom.Id
                      select r;

            var room = qry.FirstOrDefault();

            roomDb.Rooms.DeleteOnSubmit(room);
            roomDb.SubmitChanges();
        }

      

Thank you in advance:)

+3


source to share





All Articles