title: explicit save in mvvm
body: <p>i have a Grid with Employee details (fullname, age, position) and a save button.
  i want the Employee will be saved only when pressing the save button.
  how can i implement it in MVVM ?</p>
  
  <pre><code>    &lt;TextBlock
          Margin="3"
          Text="Full Name:"
          VerticalAlignment="Center"
          /&gt;
      &lt;TextBox 
          Grid.Column="1"
          Margin="3"
          Text="{Binding FullName, UpdateSourceTrigger=Explicit, ValidatesOnDataErrors=True}"
          /&gt;     
      &lt;TextBlock
          Grid.Row="1"
          Margin="3"
          Text="Age:"
          VerticalAlignment="Center"
          /&gt;
      &lt;TextBox 
          Grid.Column="1"
          Grid.Row="1"
          Margin="3"
          Text="{Binding Age, UpdateSourceTrigger=Explicit, ValidatesOnDataErrors=True}"
          /&gt;
      &lt;TextBlock
          Grid.Row="2"
          Margin="3"
          Text="Position:"
          VerticalAlignment="Center"
          /&gt;
      &lt;TextBox 
          Grid.Column="1"
          Grid.Row="2"
          Margin="3"
          Text="{Binding Position, UpdateSourceTrigger=Explicit, ValidatesOnDataErrors=True}"
          /&gt;
  
  
      &lt;Button
          Grid.Row="4"
          Grid.ColumnSpan="2"
          Content="Save"
          Command="{Binding SaveCommand}"
          Width="80"
          Height="22"
          Margin="3"
          HorizontalAlignment="Right"
          VerticalAlignment="Bottom"
          /&gt;
  </code></pre>
  
  <p>my View model with not implemented Save method:
  i'm not sure i know how to handle Explicit binding... </p>
  
  <pre><code>public string FullName
          {
              get { return _emp.FullName; }
              set 
              { 
                  _emp.FullName = value;
                  OnPropertyChanged("FullName");
              }
          }
  
          public int Age
          {
              get { return _emp.Age; }
              set 
              { 
                  _emp.Age = value;
                  OnPropertyChanged("Age");
              }
          }
  
          public string Position
          {
              get { return _emp.Position; }
              set 
              { 
                  _emp.Position = value;
                  OnPropertyChanged("Position");
              }
          }
  
  
          public EmployeeViewModel(Employee emp)
          {
              _emp = emp;
  
              _employees = new ObservableCollection&lt;EmployeeViewModel&gt;();
  
              if (_emp.Employees != null)
              {
                  foreach (Employee employee in _emp.Employees)
                      _employees.Add(new EmployeeViewModel(employee));
              }
          }
  
          public string[] ValidatedProperties =
          {
              "FullName",
              "Age",
              "Position"
          };
  
          public RelayCommand SaveCommand
          {
              get
              {
                  return _saveCommand ??
                      (_saveCommand = new RelayCommand(Save, CanSave));
              }
              set { _saveCommand = value; }
          }
  
          private bool CanSave()
          {
              foreach (string property in ValidatedProperties)
                  if (!string.IsNullOrEmpty(GetValidationError(property)))
                      return false;
  
              return true;
          }
  
          private void Save()
          {
              throw new NotImplementedException();    
          }
  </code></pre>