using ivf_tl_Entity.Entity.Mark; using ivf_tl_Entity.Enums; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace ivf_tl_Manage.UserControls { /// /// MarkWeightTreeUserControl.xaml 的交互逻辑 /// public partial class MarkWeightTreeUserControl : UserControl { public event Func MarkWeightOperTreeEvent; public MarkWeightTreeUserControl() { InitializeComponent(); } public MarkWeight MarkWeightSource { get { return (MarkWeight)GetValue(MarkWeightSourceProperty); } set { SetValue(MarkWeightSourceProperty, value); } } // Using a DependencyProperty as the backing store for MarkWeightSource. This enables animation, styling, binding, etc... public static readonly DependencyProperty MarkWeightSourceProperty = DependencyProperty.Register("MarkWeightSource", typeof(MarkWeight), typeof(MarkWeightTreeUserControl), new PropertyMetadata(null)); public Brush RectangleFill { get { return (Brush)GetValue(RectangleFillProperty); } set { SetValue(RectangleFillProperty, value); } } // Using a DependencyProperty as the backing store for RectangleFill. This enables animation, styling, binding, etc... public static readonly DependencyProperty RectangleFillProperty = DependencyProperty.Register("RectangleFill", typeof(Brush), typeof(MarkWeightTreeUserControl), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#EAEAEA")))); public Brush BackgroundSource { get { return (Brush)GetValue(BackgroundSourceProperty); } set { SetValue(BackgroundSourceProperty, value); } } // Using a DependencyProperty as the backing store for BackgroundSource. This enables animation, styling, binding, etc... public static readonly DependencyProperty BackgroundSourceProperty = DependencyProperty.Register("BackgroundSource", typeof(Brush), typeof(MarkWeightTreeUserControl), new PropertyMetadata(new SolidColorBrush(Colors.Transparent))); private void MarkWeightItemUserControl_ExpandedEvent(MarkWeight obj) { if (obj.IsExpanded) { foreach (var item in obj.children) { if (item.ParentMarkWeight == null) item.ParentMarkWeight = obj; item.RectangleFill = RectangleFill; if (item.IsExpanded) item.IsExpanded = false; } DetailItemSouce = obj.children; } else { DetailItemSouce = null; } } public ObservableCollection DetailItemSouce { get { return (ObservableCollection)GetValue(DetailItemSouceProperty); } set { SetValue(DetailItemSouceProperty, value); } } // Using a DependencyProperty as the backing store for DetailItemSouce. This enables animation, styling, binding, etc... public static readonly DependencyProperty DetailItemSouceProperty = DependencyProperty.Register("DetailItemSouce", typeof(ObservableCollection), typeof(MarkWeightTreeUserControl), new PropertyMetadata(null)); private bool? test1_MarkWeightOperEvent(MarkWeight arg1, ivf_tl_Entity.Enums.OperEnum arg2) { return MarkWeightOperTreeEvent?.Invoke(arg1, arg2); } private bool? MarkWeightTreeUserControl_MarkWeightOperTreeEvent(MarkWeight arg1, OperEnum arg2) { var aa = MarkWeightOperTreeEvent?.Invoke(arg1, arg2); if (aa == true && arg2== OperEnum.Delete) { if (arg1.ParentMarkWeight == MarkWeightSource && !MarkWeightSource.children.Any()) { this.test1.ex(); } } return aa; } } }