Current filter:
                                You should refresh the page.
                                Support Center
                                  • I have a treelist whose view intially has the NavigationStyle set to Row so the user sees a whole row selected as they move around it. The problem arises when a context menu setup is selected by the user to initiate a rename edit of the data of a specific column of the selected row. Similar to an F2 (if I could get it to work, but that is another issue).

                                    The context menu click event method initially sets the NavigationStyle to Cell and then attempts to set focus to the cell in question to allow for an edit by calling the views ShowEditor. Visually the row highlight goes away but the user is not placed into the cell nor are its contents highlighted to start the edit process. The user actually has to manually click inside the column to begin the edit.

                                    Now if I set the TreeListView's NavigationStyle to Cell in the Xaml initially, and then execute the context click, the cell gets the focus; albeit the I bar gets placed at the beginning. ???

                                    First off what can I do to get the cell focus selected when the initial state is Row, and secondly how can I get the text selected for the I-bar cursor edit?

                                    Attached is an example project created with VS2012 which targets 11.2 versions of the tools.

                                • William Wegerson 07.02.2012

                                  Our company upgraded to 12.1 and I upgraded the test project to 12.1 and the same still happens.

                                1 Solution

                                Creation Date Rating Importance Sort by

                                Hi William,

                                Thank you for your patience. You can achieve this goal by using the Dispatcher.BeginInvoke method. In this method, restore the selected row and call the ShowEditor method. You can also handle the TableView.ShownEditor method to select all text in it.

                                For instance:

                                private void renameItem_ItemClick(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e) { int i = tlMain.View.FocusedRowHandle; tlMain.View.NavigationStyle = GridViewNavigationStyle.Cell; Dispatcher.BeginInvoke(new Action(() => { tlMain.View.FocusedRowHandle = i; tlMain.View.FocusedColumn = tlMain.Columns.First(); tlMain.View.ShowEditor(); tlMain.View.ShownEditor += new DevExpress.Xpf.Grid.TreeList.TreeListEditorEventHandler(View_ShownEditor); })); } void View_ShownEditor(object sender, DevExpress.Xpf.Grid.TreeList.TreeListEditorEventArgs e) { tlMain.View.ShownEditor -= new DevExpress.Xpf.Grid.TreeList.TreeListEditorEventHandler(View_ShownEditor); tlMain.View.ActiveEditor.SelectAll(); }

                                If you have additional questions, feel free to reactivate this thread.


                                • William Wegerson 07.02.2012


                                  The dispatch code works. I only had to add the return to row selection after the edit such as:

                                  public int FocusedRowHandle { get; set; }

                                  private void renameItem_ItemClick( object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e )
                                      FocusedRowHandle = tlMain.View.FocusedRowHandle;

                                      tlMain.View.NavigationStyle = GridViewNavigationStyle.Cell;

                                      tlMain.View.CellValueChanged += View_CellValueChanged;

                                      Dispatcher.BeginInvoke( new Action( () =>
                                          tlMain.View.FocusedRowHandle = FocusedRowHandle;
                                          tlMain.View.FocusedColumn = tlMain.Columns.First();
                                          tlMain.View.ShownEditor += new DevExpress.Xpf.Grid.TreeList.TreeListEditorEventHandler( View_ShownEditor );

                                      } ) );


                                  void View_CellValueChanged( object sender, DevExpress.Xpf.Grid.TreeList.TreeListCellValueChangedEventArgs e )
                                      tlMain.View.CellValueChanged -= View_CellValueChanged;
                                      tlMain.View.NavigationStyle = GridViewNavigationStyle.Row;
                                      tlMain.View.FocusedRowHandle = FocusedRowHandle;

                                  void View_ShownEditor( object sender, DevExpress.Xpf.Grid.TreeList.TreeListEditorEventArgs e )
                                      tlMain.View.ShownEditor -= new DevExpress.Xpf.Grid.TreeList.TreeListEditorEventHandler( View_ShownEditor );

                                If you need additional product information, write to us at or call us at +1 (818) 844-3383

                                FOLLOW US

                                DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, along with high-performance HTML JS Mobile Frameworks for developers targeting iOS, Android and Windows Phone. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

                                Copyright © 1998-2017 Developer Express Inc.
                                All trademarks or registered trademarks are property of their respective owners