123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- 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.Controls.Primitives;
- namespace CyberX8_Themes.CustomControls
- {
- public class CommonValveControl : Button
- {
- public CommonValveControl()
- {
- //this.MouseDoubleClick += CommonValveControl_MouseDoubleClick;
- }
- static CommonValveControl()
- {
- DefaultStyleKeyProperty.OverrideMetadata(typeof(CommonValveControl), new FrameworkPropertyMetadata(typeof(CommonValveControl)));
- }
- //private void CommonValveControl_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
- //{
- // Status = !Status;
- //}
- public override void OnApplyTemplate()
- {
- var devBtn = GetTemplateChild("mainBody") as Grid;
- devBtn.MouseLeftButtonDown += DevBtn_Click;
- base.OnApplyTemplate();
- }
- private void DevBtn_Click(object sender, RoutedEventArgs e)
- {
- //if (IsCanEdit == true)
- //{
- // Status = !Status;
- //}
- }
- public bool Status
- {
- get => (bool)GetValue(StatusProperty);
- set => SetValue(StatusProperty, value);
- }
- public static readonly DependencyProperty StatusProperty = DependencyProperty.Register(
- "Status",
- typeof(bool),
- typeof(CommonValveControl));
- public static readonly DependencyProperty ValveOrientationProperty = DependencyProperty.Register(
- "ValveOrientation",
- typeof(Orientation),
- typeof(CommonValveControl));
- public Orientation ValveOrientation
- {
- get => (Orientation)GetValue(ValveOrientationProperty);
- set => SetValue(ValveOrientationProperty, value);
- }
- public static readonly DependencyProperty IsCanEditProperty = DependencyProperty.Register("IsCanEdit"
- , typeof(bool), typeof(CommonValveControl));
- /// <summary>
- /// 是否可以编辑
- /// </summary>
- public bool IsCanEdit
- {
- get { return (bool)GetValue(IsCanEditProperty); }
- set { SetValue(IsCanEditProperty, value); }
- }
-
- public static readonly DependencyProperty ValveTypeProperty = DependencyProperty.Register(
- "ValveType", typeof(string), typeof(CommonValveControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// Valve类型
- /// </summary>
- public string ValveType
- {
- get => (string)GetValue(ValveTypeProperty);
- set => SetValue(ValveTypeProperty, value);
- }
- public static readonly DependencyProperty ModuleNameProperty = DependencyProperty.Register(
- "ModuleName", typeof(string), typeof(CommonValveControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// ModuleName
- /// </summary>
- public string ModuleName
- {
- get => (string)GetValue(ModuleNameProperty);
- set => SetValue(ModuleNameProperty, value);
- }
- public static readonly DependencyProperty OperationNameProperty = DependencyProperty.Register(
- "OperationName", typeof(string), typeof(CommonValveControl), new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.AffectsRender));
- /// <summary>
- /// OperationName
- /// </summary>
- public string OperationName
- {
- get => (string)GetValue(OperationNameProperty);
- set => SetValue(OperationNameProperty, value);
- }
- private void OpenClick(object sender, RoutedEventArgs e)
- {
- }
- private void CloseClick(object sender, RoutedEventArgs e)
- {
- }
- }
- }
|