完成删除变量
This commit is contained in:
@@ -48,75 +48,5 @@ public partial class VariableTableView : UserControl
|
||||
IsLoadCompletion = true;
|
||||
}
|
||||
|
||||
private void DataGrid_OnCellEditEnding(object? sender, DataGridCellEditEndingEventArgs args)
|
||||
{
|
||||
if (args.EditAction != DataGridEditAction.Commit)
|
||||
return;
|
||||
|
||||
// try
|
||||
// {
|
||||
// // 获取到改变后的值和绑定的属性名
|
||||
// Variable var = (Variable)args.Row.Item;
|
||||
// var element = args.EditingElement;
|
||||
// object newValue = null;
|
||||
// string bindingPath = "";
|
||||
//
|
||||
// if (element is TextBox textBox)
|
||||
// {
|
||||
// newValue = textBox.Text;
|
||||
// DataGridTextColumn textColumn = (DataGridTextColumn)args.Column;
|
||||
// bindingPath = (textColumn.Binding as Binding)?.Path.Path;
|
||||
// }
|
||||
// else if (element is CheckBox checkBox)
|
||||
// {
|
||||
// newValue = checkBox.IsChecked;
|
||||
// DataGridCheckBoxColumn checkBoxColumn = (DataGridCheckBoxColumn)args.Column;
|
||||
// bindingPath = (checkBoxColumn.Binding as Binding)?.Path.Path;
|
||||
// }
|
||||
// else if (args.Column.Header.ToString() == "信号类型")
|
||||
// {
|
||||
// var comboBox = VisualTreeHelper.GetChild(element, 0) as ComboBox;
|
||||
// if (comboBox != null)
|
||||
// {
|
||||
// newValue = comboBox.SelectedItem;
|
||||
// bindingPath = "SignalType";
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (newValue == null || string.IsNullOrEmpty(bindingPath))
|
||||
// return;
|
||||
// // 通过反射拿到值
|
||||
// var pathPropertyInfo = var.GetType()
|
||||
// .GetProperty(bindingPath);
|
||||
// var oldValue = pathPropertyInfo.GetValue(var);
|
||||
// // 判断值是否相等
|
||||
// if (newValue.ToString() != oldValue?.ToString())
|
||||
// {
|
||||
// var.IsModified = true;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// catch (Exception e)
|
||||
// {
|
||||
// NotificationHelper.ShowError("变量表编辑的过过程中发生了错误:" + e.Message, e);
|
||||
// }
|
||||
}
|
||||
|
||||
private async void DeleteVarData_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// _viewModel = (VariableTableViewModel)this.DataContext;
|
||||
// var selectedVariables = BasicGridView.SelectedItems.Cast<Variable>().ToList();
|
||||
// if (selectedVariables.Any())
|
||||
// {
|
||||
// await _viewModel.DeleteVarData(selectedVariables);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// NotificationHelper.ShowInfo("请选择要删除的变量");
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user