终端一体化运控平台
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.

12345678910111213141516171819202122232425262728293031323334353637
  1. using Microsoft.Toolkit.Mvvm.Input;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Collections.ObjectModel;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace BeDesignerSCADA.Speical
  9. {
  10. /// <summary>
  11. /// 因ObservableCollection无法序列化,继承并实例化一个
  12. /// </summary>
  13. public class ItemsList : ObservableCollection<string>
  14. {
  15. public ItemsList()
  16. {
  17. AddCommand = new RelayCommand<string>(AddItem);
  18. DeleteCommand = new RelayCommand<string>(DeleteItem);
  19. }
  20. private void DeleteItem(string obj)
  21. {
  22. if (!string.IsNullOrEmpty(obj))
  23. Remove(obj);
  24. }
  25. public RelayCommand<string> AddCommand { get; }
  26. public RelayCommand<string> DeleteCommand { get; }
  27. private void AddItem(string txt)
  28. {
  29. if (!string.IsNullOrEmpty(txt))
  30. Add(txt);
  31. }
  32. }
  33. }