Hi,
I have a child window where I put a simple XamWebGrid containing 3 TextColumns. I have an ObservableCollection named Person:
private string _firstname;
private string _lastname;
private string _phone;
public string FirstName
{
get { return _firstname; }
set
if (value != _firstname)
_firstname =
value;
onPropertyChanged(
this, "UserFirstName");
}
public string LastName
get { return _lastname; }
if (value != _lastname)
_lastname =
this, "UserLastName");
public string Phone
get { return _phone; }
if (value != _phone)
_phone =
this, "Phone");
public event PropertyChangedEventHandler PropertyChanged;
public void onPropertyChanged(object sender, string propertyName)
if (PropertyChanged != null)
PropertyChanged(
this, new PropertyChangedEventArgs(propertyName));
The following code is how I populate the data:
person.Add(
FirstName =
"Tom",
LastName =
"Jones",
Phone =
"1234"});
new Person()
"Karen",
"AAA",
"87645"});
grdPerson.ItemsSource = person;
Below is my Xaml code:
="Visible" >
>
/>
="False">
="Wrap" />
To view the upated phone data changed, I have this code:
var qry = from rec1 in person
select rec1;
foreach (var item in qry)
MessageBox.Show("first phone " + item.Phone);
When I tried to change the phone numbers on both records, only the first record gets changed but not on the second one. I noticed this only happen on the child window. Can anyone help on this? Thanks!
I was able to reproduce the behaviour that you see.
You can call the ExitEditMode method of the XamWebGrid when the OK button is clicked. This will force the cells to exit edit mode and commit their values.
Regards
Thanks Nikolay. It worked.