I would like to be able to programmatically force a cell in the UltraGanttView grid to enter edit mode. As it stands currently, when a user uses the directional arrows to move to another cell, the cell does not enter edit mode. I would like to implement this functionality.
Is there something that would achieve something like the PerformAction function for the UltraGrid, and I'm just missing it?
Hello
One possible approach to achieve desired behavior could be if you are using the code:
private void ultraButton1_Click(object sender, EventArgs e)
{
EmbeddableUIElementBase embeddableElement = this.ultraGanttView1.UIElement.GetDescendant(typeof(EmbeddableUIElementBase)) as EmbeddableUIElementBase;
if (embeddableElement != null) ultraGanttView1.GridSettings.ColumnSettings[TaskField.Name].Editor.EnterEditMode(embeddableElement);
}
Let me know if you have any questions.
Regards
Thank you for the quick response.
This has the desired effect, but only causes the first row in the grid to enter edit mode. How do I access the currently active task?
Hello mictherr,
Maybe one possible solution for this task, could be:
// Declare List of UIElementsprivate List<UIElement> list = new List<UIElement>();
private void ultraButton1_Click(object sender, EventArgs e){ list = new List<UIElement>(); GetChild(ultraGanttView1.UIElement); EmbeddableUIElementBase embeddableElement = list[ultraGanttView1.ActiveTask.RowNumber-1].GetAncestor(typeof(EmbeddableUIElementBase)) as EmbeddableUIElementBase;
if (embeddableElement != null ) ultraGanttView1.GridSettings.ColumnSettings[TaskField.Name].Editor.EnterEditMode(embeddableElement);}
// Create a Recursive methodprivate void GetChild(UIElement element){ foreach (UIElement el in element.ChildElements) { if (el.ChildElements.Count > 0) GetChild(el); else { if(el.GetType() == typeof(ExpandableEditorWithTextIndentationUIElement)) { list.Add(el); } } }}
Please take a look at the attached video file for more details and let me know if you have any questions.
Great ! This is also possible approach to solve this task.
I've found my own solution now. I pull the RowUIElements of the UltraGanttView, find the rowuielement with the same rownumber as my active task and then iterate the child elements of that RowUIElement to retrieve the editor.
Works quite well!
As a follow up to this, this will only grab the uielements for those tasks that are presently in the view, so a reference made with row number does not work unless the user is in a row close to the top of the grid. My temporary workaround is actually to ensure that the task is in view as the top row and I enter edit mode with the first item in the list. However, this is confusing and frustrating for users. Is there a way I can get the visible index of the active row?
This absolutely works as anticipated if I call Ultraganttview1.Refresh() following the addition of the new task.
My apologies for not trying this first.
Thanks for all your help!
Hello Mictherr,
I`m not sure that I understand your scenario. Could you please upload your sample and steps that reproduce your issue and I`ll be glad to research it for you.