DevExpress TreeView 在编辑模式下添加折叠然后突出显示和聚焦行
在我的树视图中,添加折叠后,我希望该行突出显示并处于编辑模式。这样用户就可以输入新文件夹的名称。我可以聚焦节点,但无法将行设置为编辑模式。
In my treeview, after adding a fold, I want that row to be highlghted and in edit mode. So that user can enter name for new folder. I am able to focus the node but not set the row in edit mode.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有完全相同的问题,这里是代码片段,需要一个全局变量来区分常规点击和“我想编辑”点击:
首先创建一个全局变量,
在创建节点后放置此代码,这将触发编辑器(确保您已标记要编辑的网格以及要编辑的列。
将事件添加到树列表 Click 事件,添加此代码
将事件添加到 OnFocusedNodeChanged 事件,添加此代码
在您想要的 ShowingEditor 事件中放置此代码
如果您在鼠标单击中有任何操作(对于上下文菜单,请确保将 fChanged 设置为 false,因为这也会触发编辑器。
,您需要做的就是使用代码处理 ValidateEditor 和 HiddenEditor。HTH
最后
Had exactly the same issue, here's the code snips, requires a global variable to distinguish a regular click from an 'I want to edit' click:
First create a global variable
Put this code after you have created your node, this will trigger the editor (make sure you have flagged the grid for editing as well as the columns you want to edit.
Add an event to your treelist Click event, add this code
Add an event to your OnFocusedNodeChanged event, add this code
In the ShowingEditor event you want to put this code
If you have any actions in mouse clicks (for context menus, make sure to set fChanged to false as this will also trigger the editor.
Finally all you need to do is handle ValidateEditor and HiddenEditor with your code.
HTH
将
FocusedColumn
属性设置为所需的列,然后调用ShowEditor()
进入编辑模式。Set the
FocusedColumn
property to the desired column, then callShowEditor()
to enter edit mode.