Why e.Source depends on TreeView populating method?

后端 未结 2 709
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-14 11:05

I have two trees:

  1. fooTree - made up of elements,
  2. barTree - constructed by

Both trees have MouseRightButtonDown event, but the e.Sour

2条回答
  •  Happy的楠姐
    2021-01-14 11:35

    You can get the clicked item in the bartree using:

    ((e.Source) as TreeView).SelectedValue
    

    But be aware that the item must actually selected first (using leftMouse). The item is not immediately selected using rightMouse...

提交回复
热议问题