积极答复者
TreeView的selectionchange事件在设置选择为空的时候不触发

问题
答案
-
AfterSelected是你改变了选择的节点之后才触发的事件,你把原先选中的节点赋值为null,并不意味你重新换了一个新选定的节点,因此不会触发该事件。
如果你希望点击空白处把选中节点置空,那么可以考虑:
1)弄一个ContextMenu(右键菜单)。
2)绑定到TreeView上,Click事件就是设置null的代码。
If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer
Help by clicking:
Click here to donate your rice to the poor
Click to Donate
Click to feed Dogs & Cats
Found any spamming-senders? Please report at: Spam Report- 已编辑 ThankfulHeartModerator 2013年7月21日 5:01 补充回答
- 已标记为答案 Bob ShenModerator 2013年7月29日 7:23
-
看看这个帖子:http://stackoverflow.com/questions/1781458/what-event-can-i-use-when-setting-treeview-selectednode-null
If my post is helpful,please help to vote as helpful, if my post solve your question, please help to make it as answer. My sample
- 已标记为答案 Bob ShenModerator 2013年7月29日 7:23
全部回复
-
AfterSelected是你改变了选择的节点之后才触发的事件,你把原先选中的节点赋值为null,并不意味你重新换了一个新选定的节点,因此不会触发该事件。
如果你希望点击空白处把选中节点置空,那么可以考虑:
1)弄一个ContextMenu(右键菜单)。
2)绑定到TreeView上,Click事件就是设置null的代码。
If you think one reply solves your problem, please mark it as An Answer, if you think someone's reply helps you, please mark it as a Proposed Answer
Help by clicking:
Click here to donate your rice to the poor
Click to Donate
Click to feed Dogs & Cats
Found any spamming-senders? Please report at: Spam Report- 已编辑 ThankfulHeartModerator 2013年7月21日 5:01 补充回答
- 已标记为答案 Bob ShenModerator 2013年7月29日 7:23
-
看看这个帖子:http://stackoverflow.com/questions/1781458/what-event-can-i-use-when-setting-treeview-selectednode-null
If my post is helpful,please help to vote as helpful, if my post solve your question, please help to make it as answer. My sample
- 已标记为答案 Bob ShenModerator 2013年7月29日 7:23