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.

28 lines
695 B

  1. using System;
  2. using System.Windows.Controls;
  3. namespace BPA.UIControl.DataAnnotations
  4. {
  5. /// <summary>
  6. /// DataGrid 列宽
  7. /// </summary>
  8. [AttributeUsage(AttributeTargets.Property)]
  9. public class ColumnWidthAttribute : Attribute
  10. {
  11. /// <summary>
  12. /// 列宽
  13. /// </summary>
  14. public DataGridLength Width { get; }
  15. /// <summary>
  16. /// DataGrid 列宽
  17. /// </summary>
  18. /// <param name="width">列宽</param>
  19. public ColumnWidthAttribute(string width)
  20. {
  21. var converter = new DataGridLengthConverter();
  22. Width = (DataGridLength)converter.ConvertFromString(width);
  23. }
  24. }
  25. }