views:

81

answers:

1

Hi all, I have some simple forms in silverlight 4 using WCF RIA RC2 Domain Services.

All of my forms appear to be working great, I went with the traditional code behind for granular control and formatting.

The problem I am having is on one particular form the data isnt being updated unless I update one of the other fields.

Here is my code.

    void ConfirmSave_Closed(object sender, EventArgs e)
    {
        if ((bool)ConfirmSave.DialogResult)
        {
            _New = false;
            tblEmailTemplate Selected = (tblEmailTemplate)lstEmailTemplates.SelectedItem;
            Selected.Name = txtName.Text;
            Selected.Description = txtDescription.Text;
            Selected.Body = txtBody.Text;
            Selected.ModifiedBy = Security.DomainUserName;
            Selected.ModifiedOn = DateTime.Now;
            Selected.Body = txtBody.Text;
            DataStore.SubmitChanges();
            Dialogs.ConfirmationDialog Added = new Dialogs.ConfirmationDialog(Selected.Name + " has been saved.", "Email Template Saved");
            Added.Show();
            lstEmailTemplates.ItemsSource = DataStore.tblEmailTemplates;
            lstEmailTemplates.DisplayMemberPath = "Name";
        }
    }

If I type a change lets say append an 'A' to each field, Name, Description, Body - all 3 get updated.

  1. NameA
  2. DescriptionA
  3. BodyA

But if I dont make a change in description, Body is not updated.

  1. NameAB
  2. DescriptionA
  3. BodyA (Should have been BodyAB)

If I only make a change into Body its not updated. If I only make a change into Name it is updated.

This is very wierd behavior. Tracing the code down through the domain service I see the changed record having the correct changes - as far as the old record it just contained the ID and everything else was null, this is probably by design but I dont spend much time debugging the domain services layer.

Any ideas?

A: 

I had a bug like this with Check Boxes in RC1, this bug was actually in the selection changed code. A good reason to adopt the data binding techniques RIA offers.

David