views:

21

answers:

1

I've got a TreeView with a bunch of child nodes in it, all of which have child nodes of their own.

A user asked me to provide auto-completion when editing any of the "grandchild" TreeNodes, so I had to implement a floating TextBox that sits directly over the TreeNode.

Problem is, if the user scrolls the TreeView with her middle mouse button while editing the TextBox, she sees the TreeView scroll while the TextBox stays put. This, despite the fact that I have parented the TextBox to the TreeView.

So, what property or event of the TreeView can I access to make the TextBox follow all the other nodes of the TreeView when the user scrolls it?

Note: I am not using WPF. (Normally I would, but I'm modifying a pre-exisitng project.)

+1  A: 

It might be easiest to derive from TreeView and override the OnMouseWheel function. There you can either hide the TextBox or move it to keep up with your moving TreeNode. This article does something similar to what you're trying to do but with a DropDown. It hides the control in OnMouseWheel.

msergeant