You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- using Microsoft.Toolkit.Mvvm.Input;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace BeDesignerSCADA.Speical
- {
- /// <summary>
- /// 因ObservableCollection无法序列化,继承并实例化一个
- /// </summary>
- public class ItemsList : ObservableCollection<string>
- {
- public ItemsList()
- {
- AddCommand = new RelayCommand<string>(AddItem);
- DeleteCommand = new RelayCommand<string>(DeleteItem);
- }
-
- private void DeleteItem(string obj)
- {
- if (!string.IsNullOrEmpty(obj))
- Remove(obj);
- }
-
- public RelayCommand<string> AddCommand { get; }
- public RelayCommand<string> DeleteCommand { get; }
- private void AddItem(string txt)
- {
- if (!string.IsNullOrEmpty(txt))
- Add(txt);
- }
-
- }
- }
|