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

DataGridColumnOrderAttribute.cs 1.1 KiB

2 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace WPFDemo.Bb
  7. {
  8. [AttributeUsage(AttributeTargets.Property)]
  9. public class DataGridColumnOrderAttribute : Attribute
  10. {
  11. public static readonly DataGridColumnOrderAttribute Default = new DataGridColumnOrderAttribute(0);
  12. public DataGridColumnOrderAttribute(int order)
  13. {
  14. DataGridColumnOrderValue = order;
  15. }
  16. public virtual int DataGridColumnOrder => DataGridColumnOrderValue;
  17. protected int DataGridColumnOrderValue { get; set; }
  18. public override bool Equals(object obj)
  19. {
  20. if (obj == this)
  21. {
  22. return true;
  23. }
  24. return obj is DataGridColumnOrderAttribute other && other.DataGridColumnOrder == DataGridColumnOrder;
  25. }
  26. public override int GetHashCode()
  27. {
  28. return DataGridColumnOrder.GetHashCode();
  29. }
  30. public override bool IsDefaultAttribute()
  31. {
  32. return Equals(Default);
  33. }
  34. }
  35. }