| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- using ivf_tl_Entity.Entity.Mark;
- using ivf_tl_Entity.Enums;
- using System;
- using System.Collections.Generic;
- 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>
- /// MarkWeightItemUserControl.xaml 的交互逻辑
- /// </summary>
- public partial class MarkWeightItemUserControl : UserControl
- {
- public event Func<MarkWeight, OperEnum, bool?> MarkWeightOperEvent;
- public event Action<MarkWeight> ExpandedEvent;
- public MarkWeightItemUserControl()
- {
- 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(MarkWeightItemUserControl), 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(MarkWeightItemUserControl), new PropertyMetadata(new SolidColorBrush((Color)ColorConverter.ConvertFromString("#EAEAEA"))));
- private void StackPanel_MouseUp(object sender, MouseButtonEventArgs e)
- {
- ex();
- }
- private void Edit_Click(object sender, RoutedEventArgs e)
- {
- if (MarkWeightSource == null) return;
- MarkWeightOperEvent?.Invoke(MarkWeightSource, OperEnum.Edit);
- }
- private void Del_Click(object sender, RoutedEventArgs e)
- {
- if (MarkWeightSource == null) return;
- MarkWeightOperEvent?.Invoke(MarkWeightSource, OperEnum.Delete);
- }
- private void Add_Click(object sender, RoutedEventArgs e)
- {
- if (MarkWeightSource == null) return;
- MarkWeightOperEvent?.Invoke(MarkWeightSource, OperEnum.Add);
- }
- public void ex()
- {
- if (MarkWeightSource.IsExpanded)
- {
- MarkWeightSource.IsExpanded = false;
- ExpandedEvent?.Invoke(MarkWeightSource);
- if (MarkWeightSource.parentId == -1)
- {
- this.expand_Image1.Width = 10;
- this.expand_Image1.Height = 20;
- this.expand_Image1.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/unfoldMark.png", UriKind.Absolute));
- }
- else
- {
- this.expand_Image2.Width = 10;
- this.expand_Image2.Height = 20;
- this.expand_Image2.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/unfoldMark.png", UriKind.Absolute));
- }
- }
- else
- {
- MarkWeightSource.IsExpanded = true;
- ExpandedEvent?.Invoke(MarkWeightSource);
- if (MarkWeightSource.parentId == -1)
- {
- this.expand_Image1.Width = 20;
- this.expand_Image1.Height = 10;
- this.expand_Image1.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/foldMark.png", UriKind.RelativeOrAbsolute));
- }
- else
- {
- this.expand_Image2.Width = 20;
- this.expand_Image2.Height = 10;
- this.expand_Image2.Source = new BitmapImage(new Uri("pack://application:,,,/ivf_tl_Manage;component/Resources/Images/foldMark.png", UriKind.RelativeOrAbsolute));
- }
- }
- }
- }
- }
|