12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- 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 Venus_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 Orientation ValveOrientation
- {
- get => (Orientation)GetValue(CommonValveOrientationProperty);
- set => SetValue(CommonValveOrientationProperty, value);
- }
- public static readonly DependencyProperty CommonValveOrientationProperty = DependencyProperty.Register(
- "ValveOrientation",
- typeof(Orientation),
- typeof(CommonValveControl));
- 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); }
- }
- }
- }
|