using System.Windows; using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; namespace MegaRobo.C00225155App.MenuViews { /// /// 液体原样瓶属性编辑窗口 /// public partial class EditSampleBottlePropertiesWindow : Window { public EditSampleBottlePropertiesWindow() { InitializeComponent(); } //private void DataGridCell_MouseLeave(object sender, MouseEventArgs e) //{ // DataGridCell cell = sender as DataGridCell; // if (cell != null && cell.IsEditing) // { // DataGrid dataGrid = FindVisualParent(cell); // if (dataGrid != null) // { // // 提交当前编辑 // dataGrid.CommitEdit(DataGridEditingUnit.Cell, true); // // 尝试将焦点转移到DataGrid本身 // dataGrid.Focus(); // // 如果上面的方法无效,可以尝试将焦点转移到其他元素 // // 例如,找到一个按钮并将焦点转移给它 // // Button someButton = FindButtonInWindow(); // // if (someButton != null) someButton.Focus(); // } // } //} //private T FindVisualParent(DependencyObject child) where T : DependencyObject //{ // DependencyObject parentObject = VisualTreeHelper.GetParent(child); // if (parentObject == null) return null; // T parent = parentObject as T; // if (parent != null) // return parent; // else // return FindVisualParent(parentObject); //} private void SaveButton_Click(object sender, RoutedEventArgs e) { //if (myDataGrid.) //{ // if (!myDataGrid_liquid.CommitEdit(DataGridEditingUnit.Row, true)) // { // //MessageBox.Show("请完成编辑或修复验证错误。"); // return; // } //} DialogResult = true; Close(); } } }