The program uses a simple UserControl (modal window) in which a collection of color labels is edited.
The collection itself is as follows:
public static ObservableCollection<ColorVM> Colors { get; set; } = new ObservableCollection<ColorVM>() { new ColorVM {Title = "Green", Value = "#a0db8e"}, new ColorVM {Title = "Red", Value = "#b44545"}, new ColorVM {Title = "Orange", Value = "#e28356"}, new ColorVM {Title = "Blue", Value = "#2b90f5"} }; I don’t understand how to implement the Cancel button method so that all changes in the collection are rolled back to the moment before the start of editing. The idea was to implement ICloneable from ColorVM and copy the entire original collection for editing in a UserControl . But I am not sure of the correctness of this approach.
Tell me, how is this implemented correctly?
