Answer the question
In order to leave comments, you need to log in
Binding ListBox for Windows Phone
Good afternoon/evening!
I'll start from afar. There is a textbox and a listbox, when you add text to the textbox, and when you click on the save button, the text should appear in the listbox, everything seems to be fine and even works, but when you restart the application and try to save the text, the application crashes with this error: "Operation not supported on read-only collection". I decided to go the other way, created a class through binding:
public class Text
{
public String Note { get; set; }
}
List <Text> myText = new List<Text>()
{
new Text()
{
Note = "Test"
};
}
Answer the question
In order to leave comments, you need to log in
The Text class must inherit from INotifyPropertyChanged, a property of the Text object to notify a change. Why are you using List instead of ObservableCollection? List does not notify the control about changes in the properties of stored objects, use ObservableCollection . In addition, the ObservableCollection collection in which Text objects are stored, just in case, should also notify about the change. If you do everything right, then when you add an object to the ObservableCollection, everything will work.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question