| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- using System;
- using System.Windows;
- using System.Windows.Media;
- using System.Windows.Controls;
- using SHJX.Service.Common.UserColor;
- using SHJX.Service.Common.Utils;
- namespace SHJX.Service.Library.Views
- {
- /// <summary>
- /// CustomEllipse.xaml 的交互逻辑
- /// </summary>
- public partial class CustomEllipse : UserControl
- {
- public CustomEllipse()
- {
- InitializeComponent();
- }
- #region Width
- public double CapWidth
- {
- get => (double)GetValue(CapWidthProperty);
- set => SetValue(CapWidthProperty, value);
- }
- public static readonly DependencyProperty CapWidthProperty =
- DependencyProperty.Register(
- nameof(CapWidth), typeof(double),
- typeof(CustomEllipse), new UIPropertyMetadata(0.0, (obj, args) =>
- {
- var control = obj as CustomEllipse;
- var path = control?.cap;
- path.Width = Convert.ToDouble(args.NewValue);
- }));
- #endregion
- #region Height
- public double CapHeight
- {
- get => (double)GetValue(CapHeightProperty);
- set => SetValue(CapHeightProperty, value);
- }
- public static readonly DependencyProperty CapHeightProperty =
- DependencyProperty.Register(
- nameof(CapHeight), typeof(double),
- typeof(CustomEllipse), new UIPropertyMetadata(0.0, (obj, args) =>
- {
- var control = obj as CustomEllipse;
- var path = control?.cap;
- path.Height = Convert.ToDouble(args.NewValue);
- }));
- #endregion
- #region Fill
- public string CapFill
- {
- get => (string)GetValue(CapFillProperty);
- set => SetValue(CapFillProperty, value);
- }
- public static readonly DependencyProperty CapFillProperty =
- DependencyProperty.Register(
- nameof(CapFill), typeof(string),
- typeof(CustomEllipse), new UIPropertyMetadata(string.Empty, (obj, args) =>
- {
- var control = obj as CustomEllipse;
- var path = control?.cap;
- path.Fill = args.NewValue.ToString().ConvertToBrush();
- }));
- #endregion
- #region Stroke
- public string CapStroke
- {
- get => (string)GetValue(CapStrokeProperty);
- set => SetValue(CapStrokeProperty, value);
- }
- public static readonly DependencyProperty CapStrokeProperty =
- DependencyProperty.Register(
- nameof(CapStroke), typeof(string),
- typeof(CustomEllipse), new UIPropertyMetadata(string.Empty, (obj, args) =>
- {
- var control = obj as CustomEllipse;
- var path = control?.cap;
- path.Stroke = args.NewValue.ToString().ConvertToBrush();
- }));
- #endregion
- #region StrokeThickness
- public double CapStrokeThickness
- {
- get => (double)GetValue(CapStrokeThicknessProperty);
- set => SetValue(CapStrokeThicknessProperty, value);
- }
- public static readonly DependencyProperty CapStrokeThicknessProperty =
- DependencyProperty.Register(
- nameof(CapStrokeThickness), typeof(double),
- typeof(CustomEllipse), new UIPropertyMetadata(0.0, (obj, args) =>
- {
- var control = obj as CustomEllipse;
- var path = control?.cap;
- path.StrokeThickness = Convert.ToDouble(args.NewValue);
- }));
- #endregion
- #region Info
- public string Info
- {
- get => (string)GetValue(InfoProperty);
- set => SetValue(InfoProperty, value);
- }
- public static readonly DependencyProperty InfoProperty =
- DependencyProperty.Register(nameof(Info), typeof(string),
- typeof(CustomEllipse), new UIPropertyMetadata(string.Empty, (obj, args) =>
- {
- CustomEllipse control = obj as CustomEllipse;
- TextBlock path = control?.txt_info;
- path.Text = args.NewValue.ToString();
- }));
- #endregion
- }
- }
|