Click here to Skip to main content
11,703,632 members (66,768 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: WPF software MVVM bind
Hi guys I have a WPF application that is using MVM pattern. In the application I have a frame that host my page a and b, however when I change view from page a to b, and try to change my view back to page a, it does not bring me a new page instead it brings back page a with its old state. How can I stop that? Below is my code for both my xaml and view model

xaml

<MenuItem Header="Operator" Visibility="{Binding Path=MenuVisibility, Converter={StaticResource BooleanToVisibilityConverter}}"
                          Command="{Binding Path=ViewMenuCommand}" />
 
<Frame Grid.Row="1" Name="MainAPpFrame" NavigationUIVisibility="Hidden"
                Source="{Binding Path=DisplayPage, Mode=TwoWay}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" />

my view model

private Page displayPage;
 
        public Page DisplayPage
        {
            get
            {
                return displayPage;
            }
            set
            {
                if (displayPage == value)
                {
                    return;
                }
 
                this.displayPage = value;
                base.OnPropertyChanged("DisplayPage");
            }
        }
 
public ICommand ViewMenuCommand
        {
            get
            {
                if (_operatorViewMenuCommand == null)
                {
                    _operatorViewMenuCommand = new RelayCommand(
                        param => this.ProcessNavRequest());
                }
                return _operatorViewMenuCommand;
            }
        }
 
private void ProcessNavRequest()
        {
            //string uri = String.Format("/View/{0}", parameter);
            this.DisplayPage = new OperatorView();
        }
Posted 26-Feb-13 13:30pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 570
1 OriginalGriff 515
2 Sergey Alexandrovich Kryukov 460
3 Andy Lanng 209
4 CPallini 195
0 OriginalGriff 8,519
1 Sergey Alexandrovich Kryukov 7,667
2 CPallini 4,987
3 Maciej Los 4,686
4 Mika Wendelius 3,566


Advertise | Privacy | Mobile
Web02 | 2.8.150819.1 | Last Updated 26 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100