Hey guys,
I have a TreeView in which i am usign the DoubleClick event handler.
The first time i double click on the grid (this happens everytime the grid is repopulated as well)
the event does not register. For example if i double click on a checkbox (single click will not due anything as i have the BeforeCheck event handler cancel the event ) but the double click still checks it yet the DoubleClick event does not register the first time.
The second time and everytime after that it will register it.
I also have a similar problem with right click and context menu. The first time i right click nothing happens but everytime after that the context menu is launched.
I am thinking it might have to do something with jsut in time compiling but i have never seen anything like this before. Anyone have any ideas on what it could be?

9 Years
Discussion Span
Last Post by wilsotc
//Two Event handlers.

		private void treeView3_BeforeCheck(object sender, TreeViewCancelEventArgs e)
			e.Cancel = true;

		private void treeView3_DoubleClick(object sender, EventArgs e)
			Console.WriteLine("Double Click");

//folowing is in initializeComponent();
this.treeView3.DoubleClick += new System.EventHandler(this.treeView3_DoubleClick);
			this.treeView3.BeforeCheck += new System.Windows.Forms.TreeViewCancelEventHandler(this.treeView3_BeforeCheck);

Hmm, Im wondering, if perhaps it shouldnt be in initializeComponent, but, after, maybe in form load..


I tired putting it into form Load but it still does the same thing. Its just weird how it only does this on the first double click and after that it works everytime.


Correct. I cant see the reason why it is not though i have debugged step by step going through everything using breakpoints and stepping through it.


This is a known bug in the treeview control. It has existed since 2005, and is known to occur for projects running under Vista with visual styles enabled.

The only real workaround is to create a wrapper class for the treeview control and discard the double click event.

Would include links to microsoft references of the bug, but can't put them here. Google bug id 358695. Might also google 092fe0a3-073c-46d6-8d4b-10ddf7329526

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.