/// <summary> /// Changes item's name. /// </summary> /// <param name="e">Event arguments.</param> private void _ChangeName(DataGridItemEventArgs e) { // Get custom order property from event's data. CustomOrderProperty orderProperty = e.Item as CustomOrderProperty; Debug.Assert(orderProperty != null); // Check that item's name is null. if (!string.IsNullOrEmpty(orderProperty.Name)) { return; } // Get new item's name. orderProperty.Name = DataObjectNamesConstructor.GetNewNameForCustomOrderProperty(_customOrderProperties, true); // Get current cell. Cell currentCell = _insertionRow.Cells[_customOrderPropertiesXceedGrid.CurrentContext.CurrentColumn]; // Find TextBox inside the cell. TextBox textBox = XceedVisualTreeHelper.FindTextBoxInsideElement(currentCell); // Select contents of found text box. if (textBox != null) { textBox.SelectAll(); } }
/// <summary> /// Change the name of the project. /// </summary> /// <param name="e">DataGridItemEventArgs.</param> private void _ChangeNewProjectName(DataGridItemEventArgs e) { // Check that item's name is null. if (!string.IsNullOrEmpty((e.Item as ProjectDataWrapper).Name)) { return; } // Get new project name. (e.Item as ProjectDataWrapper).Name = DataObjectNamesConstructor.GetNewNameForProject(); // Find TextBox inside the cell and select new name. Cell currentCell = _InsertionRow.Cells[XceedGrid.CurrentContext.CurrentColumn]; TextBox textBox = XceedVisualTreeHelper.FindTextBoxInsideElement(currentCell); if (textBox != null) { textBox.SelectAll(); } }
/// <summary> /// Change item's name. /// </summary> /// <param name="e">DataGridItemEventArgs.</param> private void _ChangeName(Xceed.Wpf.DataGrid.DataGridItemEventArgs e) { // Check that item's name is null. if (!string.IsNullOrEmpty((e.Item as Route).Name)) { return; } // Get new item's name. (e.Item as Route).Name = DataObjectNamesConstructor.GetNameForNewDataObject( App.Current.Project.DefaultRoutes, e.Item as Route, true); // Find TextBox inside the cell and select new name. Cell currentCell = _InsertionRow.Cells[XceedGrid.CurrentContext.CurrentColumn]; TextBox textBox = XceedVisualTreeHelper.FindTextBoxInsideElement(currentCell); if (textBox != null) { textBox.SelectAll(); } }
/// <summary> /// Change item's name. /// </summary> /// <param name="e">DataGridItemEventArgs.</param> private void _ChangeName(Xceed.Wpf.DataGrid.DataGridItemEventArgs e) { // Check that item's name is null. if (!string.IsNullOrEmpty((e.Item as Order).Name)) { return; } (e.Item as Order).Name = DataObjectNamesConstructor.GetNameForNewDataObject( (IDataObjectCollection <Order>)_collectionSource.Source, e.Item as Order, false); Cell currentCell = _ordersInsertionRow.Cells[OrdersGrid.CurrentContext.CurrentColumn]; // Find TextBox inside the cell and select new name. TextBox textBox = XceedVisualTreeHelper.FindTextBoxInsideElement(currentCell); if (textBox != null) { textBox.SelectAll(); } }