protected override void OnPreparingCellForEdit(Microsoft.Windows.Controls.DataGridPreparingCellForEditEventArgs e) { Logging.Client.DebugFormat("OnPreparingCellForEdit(Row.Item.Type = {0})", e.Row.Item.GetType().Name); Logging.Client.DebugFormat(" continueEdit={0}, isNewItem={1}", continueEdit, isNewItemForContinueEdit); base.OnPreparingCellForEdit(e); var editor = e.EditingElement.FindVisualChild <PropertyEditor>(); if (editor != null) { editor.Focus(); } }
//void SetDataToClipboard(string data) //{ // Thread.Sleep(300); // this.Dispatcher.Invoke((Action)(delegate // { // Clipboard.Clear(); // Clipboard.SetData(DataFormats.Text, data); // })); //} //private void DGAttachData_CopyingRowClipboardContent(object sender, Microsoft.Windows.Controls.DataGridRowClipboardEventArgs e) //{ // Thread thread = new Thread(() => SetDataToClipboard(e.ClipboardRowContent[0].Content.ToString())); // thread.Start(); // //var content = e.ClipboardRowContent[0].Content.ToString(); // //content = content.Substring(content.Length - 1, 1); // //e.ClipboardRowContent.Clear(); // //e.ClipboardRowContent.Add(new Microsoft.Windows.Controls.DataGridClipboardCellContent(e.Item, (sender as Microsoft.Windows.Controls.DataGrid).Columns[1], content)); //} /// <summary> /// Handles the PreparingCellForEdit event of the DGAttachData control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Microsoft.Windows.Controls.DataGridPreparingCellForEditEventArgs"/> instance containing the event data.</param> private void DGAttachData_PreparingCellForEdit(object sender, Microsoft.Windows.Controls.DataGridPreparingCellForEditEventArgs e) { var contentPresenter = e.EditingElement as ContentPresenter; var editingTemplate = contentPresenter.ContentTemplate; var textBox = (editingTemplate as DataTemplate).FindName("txtValue", (contentPresenter as ContentPresenter)); if (textBox == null) { return; } if (!(textBox is TextBox)) { return; } (textBox as TextBox).Focus(); }
/// <summary> /// Handles the PreparingCellForEdit event of the DGCaseDataInfo control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Microsoft.Windows.Controls.DataGridPreparingCellForEditEventArgs"/> instance containing the event data.</param> private void DGCaseDataInfo_PreparingCellForEdit(object sender, Microsoft.Windows.Controls.DataGridPreparingCellForEditEventArgs e) { Microsoft.Windows.Controls.DataGridRow dgRow = e.Row; dgRow.IsSelected = true; var contentPresenter = e.EditingElement as ContentPresenter; var editingTemplate = contentPresenter.ContentTemplate; var textBox = (editingTemplate as DataTemplate).FindName("txtValue", (contentPresenter as ContentPresenter)); if (textBox == null) { return; } if (!(textBox is TextBox)) { return; } (textBox as TextBox).Focus(); isEditDone = false; }
private void DGCaseDataInfo_PreparingCellForEdit(object sender, Microsoft.Windows.Controls.DataGridPreparingCellForEditEventArgs e) { try { var contentPresenter = e.EditingElement as ContentPresenter; var editingTemplate = contentPresenter.ContentTemplate; var textBox = (editingTemplate as DataTemplate).FindName("txtValue", (contentPresenter as ContentPresenter)); if (textBox == null) { return; } if (!(textBox is TextBox)) { return; } (textBox as TextBox).Focus(); } catch (Exception generalException) { _logger.Error("Error occurred in DGCaseDataInfo_PreparingCellForEdit() : " + generalException.ToString()); } }
private void DGAttachData_PreparingCellForEdit(object sender, Microsoft.Windows.Controls.DataGridPreparingCellForEditEventArgs e) { }