From 0ff65572511646a83313d47edb816ab944bc22f6 Mon Sep 17 00:00:00 2001 From: lihanbo Date: Fri, 8 Nov 2024 15:28:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20MainWindow.xaml=20?= =?UTF-8?q?=E5=92=8C=20MainWindow.xaml.cs=20=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在 MainWindow.xaml 文件中: - 修改 DataGrid.RowStyle 和 DataGridCell 样式中 IsSelected 触发器的 Background 属性值。 在 MainWindow.xaml.cs 文件中: - 重构了 SelectedItems 相关代码,优化了条件判断和循环逻辑。 - 保留并调整了注释代码的缩进。 --- Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml | 4 ++-- .../MainWindow.xaml.cs | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml index 954373c..ec48c4b 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml +++ b/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml @@ -237,7 +237,7 @@ - + @@ -250,7 +250,7 @@ - + diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml.cs index b4f269d..658a9bc 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/MainWindow.xaml.cs @@ -241,23 +241,23 @@ public partial class MainWindow : Window isContinue = true; } if (isContinue) - if (ModelGenDataGrid.SelectedItems != null) - { - var selectedRows = ModelGenDataGrid.SelectedItems; - foreach (var item in selectedRows) + if (ModelGenDataGrid.SelectedItems != null) { - if (item is StuffedDataModel model) + var selectedRows = ModelGenDataGrid.SelectedItems; + foreach (var item in selectedRows) { - //var stuffedItem = ViewModel.StuffedData.Where(it => it.WireName == model.WireName).First(); - if (model.IsError) + if (item is StuffedDataModel model) { + //var stuffedItem = ViewModel.StuffedData.Where(it => it.WireName == model.WireName).First(); + if (model.IsError) + { - //stuffedItem.IsIgnore = true; - model.IsIgnore = true; + //stuffedItem.IsIgnore = true; + model.IsIgnore = true; + } } } } - } } private void Copy_Click(object sender, RoutedEventArgs e)