title: WPF MVVM Prevent tab change
body: <p>I am having a WPF Tab control with two tabs called "OFFLINE" &amp; "ONLINE". When "ONLINE" tab click, I need to chek whether application is in online status or not.If (status ! = online) 
  display error message and prevent displaying "ONLINE" (2nd) tab and go to "OFFLINE" tab.</p>
  
  <p><strong>VIEW.XAML</strong></p>
  
  <pre><code> &lt;TabControl Name="dashboardTabControl" SelectedIndex="{Binding SelectedTabIndex,Mode=TwoWay}"&gt;
          &lt;TabItem Header="Local Dashboard"&gt;
              &lt;views:OfflineDashboard DataContext="{Binding OfflineDashboardViewModel}"/&gt;
          &lt;/TabItem&gt;
          &lt;TabItem Header="Online Dashboard"&gt;
              &lt;views:OnlineDashboard DataContext="{Binding OnlineDashboardViewModel}"/&gt;
          &lt;/TabItem&gt;
      &lt;/TabControl&gt;
  </code></pre>
  
  <p><strong>VIEWMODEL</strong></p>
  
  <pre><code>       public int SelectedTabIndex
          {
              get
              {
                  return this.selectedTabIndex;
              }
  
              set
              {
                  if (value == 1 &amp;&amp; !applicationData.IsApplicationOnline())
                  {
                      this.SelectedTabIndex = 0;
                  }
                  else
                  {
                      this.selectedTabIndex = value;
                  }
  
                  // TODO : According to the selected tab index , populate ONLINE/OFFLINE 
  viewmodels
  
  NotifyPropertyChange("SelectedTabIndex");
              }
          }
  </code></pre>
  
  <p><strong>Question</strong> : Although i checked status and set tab to 0, it doesn't work.
  always onclick of 2nd tab it will displayed ONLINE tab.</p>