Hi, I have a small silverlight app, where i have a list of objects with a Name and a Description. I databind them to a listbox, and show them, no problems.
However i want to be able to change the name or the description from my codebehind (updated through a webservice) and make the UI update, how to make the ui reflect the change of e.g. my name?
EDIT: Made the binding twoway, implemented the interface INotifyPropertyChanged interface, still not working. Debugging shows that the PropertyChanged event is not assigned
public string Name
{
get
{
return name;
}
set
{
OnPropertyChanged("Name");
}
}
and the OnPropertyChanged method
private void OnPropertyChanged(string property)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
I never get into the 'if', the event is null i.e. not assigned by anyone ???
SOLUTION: Updated the setter to use the instance variable of 'name', tried it first with the property 'Name' this gave a stackoverflow :-)