Answer the question
In order to leave comments, you need to log in
How can the ObservableCollection property indicate that an element has been changed?
Hello,
there is a Page object, with the code
public ObservableCollection<VPost> Sourse {
get {
return MyData.Sourse;
}
}
private static ObservableCollection<VPost> myDataGet = new ObservableCollection<VPost>();
private static ObservableCollection<VPost> myDataPhrase = new ObservableCollection<VPost>();
private static ObservableCollection<VPost> myDataGetDb = new ObservableCollection<VPost>();
private string getDataType;
public ObservableCollection<VPost> Sourse {
get {
if (getDataType == "getGet") return myDataGet;
else if (getDataType == "getPhrase") return myDataPhrase;
else return myDataGetDb;
}
set {
if (getDataType == "getGet" && value != myDataGet)
myDataGet = value;
else if (getDataType == "getPhrase" && value != myDataPhrase)
myDataPhrase = value;
else if (value != myDataPhrase)
myDataGetDb = value;
OnPropertyChanged("Sourse");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName) {
var handler = PropertyChanged;
if (handler != null)
handler(this, new PropertyChangedEventArgs(propertyName));
}
Answer the question
In order to leave comments, you need to log in
When adding elements to MyData.Sourse, nothing changes, I found a similar code, that is, nothing is displayed at all, although I know that MyData.Sourse has been updated.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question