title: BindableBase - SetProperty does not work using the instance of the ViewModel
body: <p>I am trying to set the property of the MainViewModel from LoginViewModel using an instance of the MainViewModel inside LoginViewModel . But the binding in XAML does not get notified ! I set the break point inside the MainViewModel and  it shows the value is being set, but if its set through instance it does not work. Can anyone help?
  Below are the codes for both viewmodel. As you can see, in my loginviewmodel I set the public property using the instance of MainViewModel :</p>
  
  <pre><code>MainViewModel.Instance.Mainviewpageindex = 1;
  </code></pre>
  
  <p>MainViewModel</p>
  
  <pre><code>namespace DataRetrieval.ViewModels
  {
      public class MainViewModel : BindableBase
      {
          private static MainViewModel _instance = new MainViewModel();
          public static MainViewModel Instance { get { return _instance; }
  
  
          }
  
          private int _mainviewpageindex;
          public int Mainviewpageindex
          {
              get { 
                  return _mainviewpageindex; }
              set { 
                 SetProperty(ref _mainviewpageindex, value);
                //  _mainviewpageindex = value;
                 // RaisePropertyChangedEvent("Mainviewpageindex");
              } 
          }
  
          public MainViewModel()
          {
              Mainviewpageindex = 0;
  
          }
  
            public DelegateCommand&lt;object&gt; _loginCommand;
            public ICommand LoginCommand
            {
                get
                {
                    _loginCommand = new DelegateCommand&lt;object&gt;(Login, VerifyLogin);
                    return _loginCommand;
                }
            }
              private void Login(object context)
              {
                  Mainviewpageindex = 1;
              }
  
  
              private bool VerifyLogin(object context)
              {
                  return true;
              }
  
      }
  </code></pre>
  
  <p>LoginViewModel</p>
  
  <pre><code>namespace DataRetrieval.ViewModels
  {
  
          public class LoginViewModel : BindableBase
          {
            //  public SecureString SecurePassword { private get; set; }
              private string _uname;
              public string Uname
              {
                  get { return _uname; }
                  set { 
                      SetProperty(ref _uname, value);
                     _loginCommand.RaiseCanExecuteChanged();
  
                  }
              }
              private SecureString _securePassword;
              public SecureString SecurePassword
              {
                  get { return _securePassword; }
                  set {
                      SetProperty(ref _securePassword, value);
                      _loginCommand.RaiseCanExecuteChanged();
                  }
              }
  
              public LoginViewModel()
              {
  
              }
  
              public DelegateCommand&lt;object&gt; _loginCommand;
              public ICommand LoginCommand
              {
                  get
                  {
                      _loginCommand = new DelegateCommand&lt;object&gt;(Login, VerifyLogin);
                      return _loginCommand;
                  }
              }
  
              private void Login(object context)
              {
                  if (SecurePassword != null || Uname != null)
                  {
                      //PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
                     // bool validated = ctx.ValidateCredentials(Uname, SecureStringToString(SecurePassword));
                    MainViewModel.Instance.Mainviewpageindex = 1;
  
                  }else
                  {
  
                  }
  
              }
              String SecureStringToString(SecureString value)
              {
                  IntPtr valuePtr = IntPtr.Zero;
                  try
                  {
                      valuePtr = Marshal.SecureStringToGlobalAllocUnicode(value);
                      return Marshal.PtrToStringUni(valuePtr);
                  }
                  finally
                  {
                      Marshal.ZeroFreeGlobalAllocUnicode(valuePtr);
                  }
              }
  
              private bool VerifyLogin(object context)
              {
                  return true;
              }
          }
  
      }
  </code></pre>
  
  <p>XAML:</p>
  
  <pre><code>&lt;Window x:Class="DataRetrieval.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
           xmlns:views="clr-namespace:DataRetrieval.Views"
             xmlns:prism="http://www.codeplex.com/prism"
            xmlns:viewModels="clr-namespace:DataRetrieval.ViewModels"
          Title="Data Retrieval Tool" Height="Auto" Width="900" Icon="Resources/colorful_query_mark_light_bulb_28261523_y2o_icon.ico"&gt;
      &lt;Window.DataContext&gt;
          &lt;viewModels:MainViewModel /&gt;
      &lt;/Window.DataContext&gt;
      &lt;TabControl Name="TabControl1" BorderBrush="{x:Null}" Background="White" SelectedIndex="{Binding Mainviewpageindex, UpdateSourceTrigger=PropertyChanged,  Mode=TwoWay}"&gt;
          &lt;TabControl.ItemContainerStyle&gt;
              &lt;Style TargetType="{x:Type TabItem}"&gt;
                  &lt;Setter Property="Visibility" Value="Collapsed"/&gt;
              &lt;/Style&gt;
          &lt;/TabControl.ItemContainerStyle&gt;
          &lt;TabItem Header="General"&gt;
  
              &lt;Grid&gt;
                  &lt;Grid.ColumnDefinitions&gt;
                      &lt;ColumnDefinition Width="*"/&gt;
                      &lt;ColumnDefinition Width="*" MaxWidth="300"/&gt;
                      &lt;ColumnDefinition Width="*" /&gt;
                  &lt;/Grid.ColumnDefinitions&gt;
                  &lt;Grid.RowDefinitions&gt;
                      &lt;RowDefinition Height="50"/&gt;
                      &lt;RowDefinition Height="auto" /&gt;
                      &lt;RowDefinition Height="300"/&gt;
                  &lt;/Grid.RowDefinitions&gt;
                  &lt;views:Login HorizontalAlignment="Center" VerticalAlignment="Center"  Grid.Column="1" Grid.Row="1" /&gt;
                  &lt;TextBlock  TextWrapping="Wrap" TextAlignment="Center" Text="User your OneAbbott domain user name and password to login into the system" Grid.Column="1" Grid.Row="2"/&gt;
                  &lt;Button  x:Name="btnLogin" Content="Login" Margin="20" Command="{Binding LoginCommand}"/&gt;
              &lt;/Grid&gt;
  
  
  
          &lt;/TabItem&gt;
          &lt;TabItem Header="Second Tab"&gt;
              &lt;StackPanel&gt;
                  &lt;TextBlock  TextWrapping="Wrap" TextAlignment="Center" Text="Login Successfull" Grid.Column="1" Grid.Row="2"/&gt;
  
  
              &lt;/StackPanel&gt;
          &lt;/TabItem&gt;
  
      &lt;/TabControl&gt;
  &lt;/Window&gt;
  </code></pre>