title: Dataform submit and cancel buttons
body: <p>I'm having trouble with the Commit and Cancel buttons in the dataform for Silverlight.
  At first I couldn't figure out why the Cancel button was not enabled when the user clicked edit. After some research I found this was because the object was not IEditableObject. That sorted the cancel button but now the Commit button has decided to become enabled, where it wasn't before, even after the value has changed.</p>
  
  <p>My question is, how do I get it is to be enabled?</p>
  
  <p>XAML:</p>
  
  <pre><code>    &lt;dataFormToolkit:DataForm CurrentItem="{Binding ViewModel, ElementName=AccountPage, Mode=TwoWay}" CommandButtonsVisibility="{Binding ViewModel.CommandButtonsVisibility, ElementName=AccountPage, Mode=TwoWay}" AutoEdit="False" AutoGenerateFields="False" AutoCommit="False"&gt;
          &lt;dataFormToolkit:DataForm.EditTemplate&gt;
              &lt;DataTemplate&gt;
                  &lt;StackPanel&gt;
                      &lt;dataFormToolkit:DataField Label="Organisation Name"&gt;
                          &lt;TextBox Text="{Binding Customer.Name, Mode=TwoWay}"/&gt;
                      &lt;/dataFormToolkit:DataField&gt;
                  &lt;/StackPanel&gt;
              &lt;/DataTemplate&gt;
          &lt;/dataFormToolkit:DataForm.EditTemplate&gt;
      &lt;/dataFormToolkit:DataForm&gt;
  </code></pre>
  
  <p>XAML.cs:</p>
  
  <pre><code>public partial class Account : Page
  {
      public VMAccount ViewModel { get; set; }
  
      public Account()
      {
          InitializeComponent();
      }
  
      // Executes when the user navigates to this page.
      protected override void OnNavigatedTo(NavigationEventArgs e)
      {
          ViewModel = new VMAccount(Global.Client.CurrentPerson.Customer);
      }
  
  }
  </code></pre>
  
  <p>VMAccount:</p>
  
  <pre><code>public class VMAccount : VMBase, IEditableObject
  {
      public VMAccount(Customer customer)
      {
          Customer = customer;
      }
  
      private Customer m_oCustomer;
      public Customer Customer
      {
          get { return m_oCustomer; }
          set
          {
              if (m_oCustomer != value)
              {
                  m_oCustomer = value;
                  OnPropertyChanged("Customer");
              }
          }
      }
  
      public event EventHandler&lt;AsyncResultArgs&gt; SaveCustomerSuccess;
      public event EventHandler&lt;AsyncResultArgs&gt; SaveCustomerFailure;
  
      #region IEditableObject Members
  
      public void BeginEdit()
      {
          Customer.PropertyChanged += new PropertyChangedEventHandler(OnCustomerPropertyChanged);
          Customer.ContactInfo.PropertyChanged += new PropertyChangedEventHandler(OnCustomerPropertyChanged);
      }
  
      public void CancelEdit()
      {
          (Customer as IRevertibleChangeTracking).RejectChanges();
          (Customer.ContactInfo as IRevertibleChangeTracking).RejectChanges();
      }
  
      public void EndEdit()
      {
          if (Customer.HasChanges)
          {
              Global.Client.MainContext.SubmitChanges((lo) =&gt;
              {
                  HandleResult("Save Customer", lo, true, SaveCustomerSuccess, SaveCustomerFailure);
              }, null);
          }
      }
  
      #endregion
  
      private void OnCustomerPropertyChanged(object sender, PropertyChangedEventArgs e)
      {
          OnPropertyChanged("Customer");
      }
  }
  </code></pre>
  
  <p>VMBase:</p>
  
  <pre><code>public class VMBase : INotifyPropertyChanged
  {
      protected virtual void OnPropertyChanged(string property)
      {
          if (PropertyChanged != null) 
              PropertyChanged(this, new PropertyChangedEventArgs(property));
      }
  
      #region INotifyPropertyChanged Members
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      #endregion
  }
  </code></pre>
  
  <p>I put in the 'OnCustomerPropertyChanged' event handler to see if I could force the dataform to acknoledge the Customer property has changed but it doesn't make a difference, even though the event is firing. I've tried removing the IEditableObject to confirm that this is the problem...</p>
  
  <pre><code>public class VMAccount : VMBase//, IEditableObject
  ...
  </code></pre>
  
  <p>Thanks for any help.</p>
  
  <p>EDIT: I should add that Customer is an RIA Entity</p>