public MainVM() { sync = SynchronizationContext.Current; rand = new Random(); CharMaskList.CollectionChanged += (s, e) => { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (CharMaskModel item in e.NewItems) { item.VM = this; } } //OnPropertyChanged(nameof(CharMaskList)); }; MaskList.CollectionChanged += (s, e) => { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (MaskModel item in e.NewItems) { item.VM = this; } } //OnPropertyChanged(nameof(MaskList)); }; //KeyList.CollectionChanged += (s, e) => OnPropertyChanged(nameof(KeyList)); MaskList.Add(new MaskModel { Mask = "%%-$$$$-$$$$-@@" }); CharMaskList.Add(new CharMaskModel { Char = '$', Chars = "1234567890" }); CharMaskList.Add(new CharMaskModel { Char = '@', Chars = "qwertyuiopasdfghjklzxcvbnm" }); CharMaskList.Add(new CharMaskModel { Char = '%', Chars = "QWERTYUIOPASDFGHJKLZXCVBNM" }); }
public MainVM() { sync = SynchronizationContext.Current; CharMaskList.CollectionChanged += (s, e) => { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (CharMaskModel item in e.NewItems) { item.VM = this; } } }; CharMaskList.Add(new CharMaskModel() { Char = '$', Chars = "0123456789" }); Mask = "$$$$"; }