SV2功能增加

一些功能的修复
This commit is contained in:
2025-05-21 12:17:46 +08:00
parent 03fd92ac86
commit 34ec76fda5
11 changed files with 507 additions and 83 deletions

View File

@@ -43,6 +43,22 @@ namespace CapMachine.Shared.Controls
}
}
/// <summary>
/// ContextMenu在WPF中是一个特殊元素它不在常规视觉树中而是在独立的窗口中
/// 这导致ElementName绑定可能无法正常工作,所以用这个方式来获取
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ExdMenuClick(object sender, RoutedEventArgs e)
{
if (ExdCommand != null && ExdCommand.CanExecute(ExdCommandParameter))
{
ExdCommandParameter = this;
ExdCommand.Execute(ExdCommandParameter);
}
}
/// <summary>
/// 仪表名称
/// </summary>
@@ -192,6 +208,32 @@ namespace CapMachine.Shared.Controls
//public event PropertyChangedEventHandler? PropertyChanged;
/// <summary>
/// 拓展控制切换 命令
/// </summary>
public ICommand ExdCommand
{
get { return (ICommand)GetValue(ExdCommandProperty); }
set { SetValue(ExdCommandProperty, value); }
}
public static readonly DependencyProperty ExdCommandProperty =
DependencyProperty.Register("ExdCommand", typeof(ICommand), typeof(Meter), new PropertyMetadata(default(ICommand)));
/// <summary>
/// ExdCommand 参数
/// </summary>
public object ExdCommandParameter
{
get
{
return (object)base.GetValue(Meter.ExdCommandParameterProperty);
}
set
{
base.SetValue(Meter.ExdCommandParameterProperty, value);
}
}
public static readonly DependencyProperty ExdCommandParameterProperty = DependencyProperty.Register("ExdCommandParameter", typeof(object), typeof(Meter), new PropertyMetadata());
@@ -376,5 +418,6 @@ namespace CapMachine.Shared.Controls
}
}
}
}