如果某些屬性具有特定值,我想拒絕刪除一行,例如,如果產品類型是 Steel,我想拒絕用戶刪除該行。我正在為我的數據網格設置源,如下所示:dataGridSourceList = new ObservableCollection<DatabaseItems>(TempController.Instance.SelectItemsByUserId(Globals.CurrentUser.Id));dtgMainItems.ItemsSource = dataGridSourceList;我看到有一個屬性CanUserDeleteRows我已經將此添加到 xaml 中我的數據網格的定義中,但我不確定如何正確應用它..CanUserDeleteRows="{Binding ElementName=dtgMainItems, Path=SelectedItem.IsDeleteEnabled}"任何形式的幫助都會很棒謝謝
如何根據類屬性值拒絕刪除行?C# WPF
慕的地6264312
2022-06-18 17:02:57
