DropDownElement.cs 1.2 KB

123456789101112131415161718192021222324252627
  1. using System.Windows;
  2. using HandyControl.Data;
  3. namespace HandyControl.Controls;
  4. public class DropDownElement
  5. {
  6. public static readonly DependencyProperty ConsistentWidthProperty = DependencyProperty.RegisterAttached(
  7. "ConsistentWidth", typeof(bool), typeof(DropDownElement),
  8. new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits));
  9. public static void SetConsistentWidth(DependencyObject element, bool value)
  10. => element.SetValue(ConsistentWidthProperty, ValueBoxes.BooleanBox(value));
  11. public static bool GetConsistentWidth(DependencyObject element)
  12. => (bool) element.GetValue(ConsistentWidthProperty);
  13. public static readonly DependencyProperty AutoWidthProperty = DependencyProperty.RegisterAttached(
  14. "AutoWidth", typeof(bool), typeof(DropDownElement),
  15. new FrameworkPropertyMetadata(ValueBoxes.FalseBox, FrameworkPropertyMetadataOptions.Inherits));
  16. public static void SetAutoWidth(DependencyObject element, bool value)
  17. => element.SetValue(AutoWidthProperty, ValueBoxes.BooleanBox(value));
  18. public static bool GetAutoWidth(DependencyObject element)
  19. => (bool) element.GetValue(AutoWidthProperty);
  20. }