title: In mvvm can we call viewmodel's methods from view?
body: <p>I am trying to retrieve uri parameters in my viewmodels. I tried severals things but nothing works as expected... I would like to mimic OnNavigatedTo and OnNavigatedFrom methods of Page so I wrote :</p>
  
  <p>In my ViewBase class (inherited from Page) :</p>
  
  <pre><code>
  public ViewModelBase ViewModel
  {
      get { return this.DataContext as ViewModelBase; }
      protected set
      {
          if (value != this.DataContext)
          {
              this.DataContext = value;
          }
      }
  }
  
  protected override void OnNavigatedFrom(NavigationEventArgs e)
  {
      base.OnNavigatedFrom(e);
      this.ViewModel.OnNavigatedFrom(e.Uri);
  }
  
  protected override void OnNavigatedTo(NavigationEventArgs e)
  {
      base.OnNavigatedTo(e);
      this.ViewModel.OnNavigatedTo(e.Uri);
  }
  </code></pre>
  
  <p>and in my ViewModelBase class :</p>
  
  <pre><code>
  public virtual void OnNavigatedFrom(Uri uri)
  {
  }
  
  public virtual void OnNavigatedTo(Uri uri)
  {
  }
  </code></pre>
  
  <p>What is wrong if I do that ?</p>
  
  <p>Thanks in advance...</p>