CNC执行逻辑的开发,点击运行,停止

This commit is contained in:
zhengxuan.zhang
2026-04-27 16:18:47 +08:00
parent e24bfef3e6
commit 2a64d48b54
14 changed files with 1450 additions and 16 deletions
@@ -0,0 +1,34 @@
using System.Windows;
using System.Windows.Controls;
namespace XplorePlane.Controls
{
/// <summary>
/// Attached behavior that calls BringIntoView() on a TreeViewItem
/// whenever the AutoScroll property transitions to true.
/// Bind to IsRunningNode to auto-scroll the executing node into view.
/// </summary>
public static class CncExecutionScrollBehavior
{
public static readonly DependencyProperty AutoScrollProperty =
DependencyProperty.RegisterAttached(
"AutoScroll",
typeof(bool),
typeof(CncExecutionScrollBehavior),
new PropertyMetadata(false, OnAutoScrollChanged));
public static bool GetAutoScroll(DependencyObject obj)
=> (bool)obj.GetValue(AutoScrollProperty);
public static void SetAutoScroll(DependencyObject obj, bool value)
=> obj.SetValue(AutoScrollProperty, value);
private static void OnAutoScrollChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (e.NewValue is true && d is TreeViewItem item)
{
item.BringIntoView();
}
}
}
}