title: Binding ViewModel property to a View
body: <p>I have the following (a base class for pages and a viewmodel class):</p>
  
  <pre><code>  public class MySuperPage : Page {
        public MySuperPageViewModel VM = new MySuperPageViewModel();
  
        ..........
        ..........
  
        public class MySuperPageViewModel {
          protected bool _ShowProgress = false;
          public bool ShowProgress {
              get { return _ShowProgress; }
              set {
                  _ShowProgress = value;
                  OnPropertyChanged("ShowProgress");
              }
          }
  
          public event PropertyChangedEventHandler PropertyChanged;
  
          public void OnPropertyChanged(string property) {
              if (PropertyChanged != null)
                  PropertyChanged(this, new PropertyChangedEventArgs(property));
          }
        }
    }
  </code></pre>
  
  <p>Then an actual page</p>
  
  <pre><code>  public class MyPage : MySuperPage(){
        public MyPage() : base() {
            this.InitializeComponent();
        }
    }
  </code></pre>
  
  <p>The XAML is the following:</p>
  
  <pre><code>  &lt;my:MySuperPage
  xmlns:my="using:MyNamespace"
  x:Name="pageRoot"
  x:Class="MyPages.MyPage"
  DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
  ....&gt;
  
       &lt;ProgressRing IsActive="{Binding VM.ShowProgress, ElementName=pageRoot}" ... /&gt;
  </code></pre>
  
  <p>If in the code-behind I do actions such as</p>
  
  <pre><code>this.VM.ShowProgress = true; // or false
  </code></pre>
  
  <p>the effects are not visible.</p>
  
  <p>Instead, things work if I assign object 'VM' to DefaultViewModel (which is an ObservableCollection):</p>
  
  <pre><code> this.DefaultViewModel["VM"] = VM;
  </code></pre>
  
  <p>I.e., in this last case using {Binding DefaultViewModel.VM.ShowProgress, ElementName=pageRoot} I manage to have the progress ring reflect the state of the VM instance.</p>
  
  <p>I feel to miss something.</p>