From 559890c482f5973f06aafdfec9550fee5ba3c7f2 Mon Sep 17 00:00:00 2001
From: wenxiangchao <wenxiangchao@ihengxin.com.cn>
Date: 星期一, 09 十一月 2026 17:02:15 +0800
Subject: [PATCH] feat: CAN 模拟器 TCP 化 + 多设备并发调试 + 后台生命周期管理
---
HMI.UI/DpUtil/DataGridHelper.cs | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/HMI.UI/DpUtil/DataGridHelper.cs b/HMI.UI/DpUtil/DataGridHelper.cs
index b9fce70..bf113c1 100644
--- a/HMI.UI/DpUtil/DataGridHelper.cs
+++ b/HMI.UI/DpUtil/DataGridHelper.cs
@@ -16,5 +16,41 @@
public static readonly DependencyProperty SelectedColumnProperty =
DependencyProperty.RegisterAttached("SelectedColumn", typeof(DataGridColumn), typeof(Grid),
new PropertyMetadata(null));
+
+ public static bool GetShowRowNumber(DependencyObject obj)
+ {
+ return (bool)obj.GetValue(ShowRowNumberProperty);
+ }
+ public static void SetShowRowNumber(DependencyObject obj, bool value)
+ {
+ obj.SetValue(ShowRowNumberProperty, value);
+ }
+
+ public static readonly DependencyProperty ShowRowNumberProperty =
+ DependencyProperty.RegisterAttached("ShowRowNumber", typeof(bool), typeof(DataGrid),
+ new PropertyMetadata(false, OnShowRowNumberChanged));
+
+ private static void OnShowRowNumberChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is DataGrid grid)
+ {
+ if (e.Property == ShowRowNumberProperty)
+ {
+ if (((bool)e.NewValue))
+ {
+ grid.LoadingRow += Grid_LoadingRow;
+ }
+ else
+ {
+ grid.LoadingRow -= Grid_LoadingRow;
+ }
+ }
+ }
+ }
+
+ private static void Grid_LoadingRow(object sender, DataGridRowEventArgs e)
+ {
+ e.Row.Header = e.Row.GetIndex() + 1;
+ }
}
}
--
Gitblit v1.9.1