TipElement.cs 1.5 KB

123456789101112131415161718192021222324252627282930
  1. using System.Windows;
  2. using HandyControl.Data;
  3. namespace HandyControl.Controls;
  4. public class TipElement
  5. {
  6. public static readonly DependencyProperty VisibilityProperty = DependencyProperty.RegisterAttached(
  7. "Visibility", typeof(Visibility), typeof(TipElement), new PropertyMetadata(Visibility.Collapsed));
  8. public static void SetVisibility(DependencyObject element, Visibility value) => element.SetValue(VisibilityProperty, value);
  9. public static Visibility GetVisibility(DependencyObject element) => (Visibility) element.GetValue(VisibilityProperty);
  10. public static readonly DependencyProperty PlacementProperty = DependencyProperty.RegisterAttached(
  11. "Placement", typeof(PlacementType), typeof(TipElement), new PropertyMetadata(default(PlacementType)));
  12. public static void SetPlacement(DependencyObject element, PlacementType value) => element.SetValue(PlacementProperty, value);
  13. public static PlacementType GetPlacement(DependencyObject element) => (PlacementType) element.GetValue(PlacementProperty);
  14. public static readonly DependencyProperty StringFormatProperty = DependencyProperty.RegisterAttached(
  15. "StringFormat", typeof(string), typeof(TipElement), new PropertyMetadata("#0.0"));
  16. public static void SetStringFormat(DependencyObject element, string value)
  17. => element.SetValue(StringFormatProperty, value);
  18. public static string GetStringFormat(DependencyObject element)
  19. => (string) element.GetValue(StringFormatProperty);
  20. }