title: MVVM OnPropertyChanged not working
body: <p>I have a problem with <code>PropertyChanged</code> event, because it is always null, I have been trying to set DataContext for many ways, but it always is null, here is some code:</p>
  
  <pre><code>    public event PropertyChangedEventHandler PropertyChanged;
  
      public void OnPropertyChanged(string propertyName)
      {
          PropertyChangedEventHandler handler = this.PropertyChanged;
          if (handler != null)
          {
              var e = new PropertyChangedEventArgs(propertyName);
              handler(this, e);
          }
      }
  </code></pre>
  
  <p>Override method OnStartup in App class</p>
  
  <pre><code>    protected override void OnStartup(StartupEventArgs e)
      {
          base.OnStartup(e);
  
          MainWindow window = new MainWindow();
          MainWindowViewModel mwvm = new MainWindowViewModel();
          window.DataContext = mwvm;
          window.Show();
      }
  
  
  
  public class MainWindowViewModel : ViewModelBase
  {
      private ICommand _ChangePageCommand;
      private IPageViewModel _CurrentPageViewModel;
      private List&lt;IPageViewModel&gt; _PageViewModels;
      public List&lt;IPageViewModel&gt; PageViewModels
      {
          get
          {
              if (_PageViewModels == null)
                  _PageViewModels = new List&lt;IPageViewModel&gt;();
              return _PageViewModels;
          }
      }
      public IPageViewModel CurrentPageViewModel
      {
          get
          {
              return _CurrentPageViewModel;
          }
          set
          {
              if (_CurrentPageViewModel != value)
              {
                  _CurrentPageViewModel = value;
                  OnPropertyChanged("CurrentPageViewModel");
              }
          }
      }
      public ICommand ChangePageCommand
      {
          get
          {
              if (_ChangePageCommand == null)
              {
                  _ChangePageCommand = new RelayCommand(
                                          p =&gt; ChangeViewModel((IPageViewModel)p),
                                          p =&gt; p is IPageViewModel);
              }
              return _ChangePageCommand;
          }
      }
  
      public MainWindowViewModel()
      {
          PageViewModels.Add(new FtpSettingsViewModel());
  
          CurrentPageViewModel = PageViewModels[0];
      }
  
  
  
      private void ChangeViewModel(IPageViewModel p)
      {
          if (!PageViewModels.Contains(p))
              PageViewModels.Add(p);
  
          CurrentPageViewModel = PageViewModels.FirstOrDefault(vm =&gt; vm == p);
      }
  }
  </code></pre>
  
  <p>I have no idea what's wrong</p>