单击节点图像时,T​​reeView展开或折叠 [英] TreeView expand or collapse when clicking on node image

查看:54
本文介绍了单击节点图像时,T​​reeView展开或折叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经搜索了很多,寻找问题的答案,但我还没有找到

我希望我的asp TreeView在单击每个节点的图标时可以展开或折叠,我在双击该节点时已经看到很多展开或折叠,但是我只希望在单击节点图像时看到它

出现问题是因为我们有一项不允许使用+/-按钮的要求.

Ive searched a lot looking for an answer for the problem but i havent found it

I want my asp TreeView to expand or collapse when clicking on the icon of each node, I ve seen a lot of expanding or collapsing when double clicking on the node, but i want it when clicking on the node image ONLY

The problem comes because we have a requirement which is not allowed to have the +/- buttons.

推荐答案



您可以使用NodeMouseClick事件,只需检查节点是否已展开.

Hi,

you can use the NodeMouseClick Event and simply check if node is expanded or not.

if (e.Node.IsExpanded)
                e.Node.Collapse();
            else if (e.Node.Nodes.Count > 0)
                e.Node.Expand();




致以最诚挚的问候




With best Regards


这篇关于单击节点图像时,T​​reeView展开或折叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆