| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- 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
- {
- /// <summary>
- /// MarkWeightTreeUserControl.xaml 的交互逻辑
- /// </summary>
- public partial class MarkWeightTreeUserControl : UserControl
- {
- public event Func<MarkWeight, OperEnum, bool?> 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<MarkWeight> DetailItemSouce
- {
- get { return (ObservableCollection<MarkWeight>)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<MarkWeight>), 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;
- }
- }
- }
|