We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Clicking on +/- stops working after implementing MouseUp and MouseDown

I derived from TreeViewAdv and implemented MouseDown and MouseUp as shown below. After I added these two events I can no longer click on the +/- of a node to expand or collapse. I can only do it through double clicking the text.

Any help is appreciated.
Dave

========

public partial class TreeView : TreeViewAdv
{
public TreeView()
{
InitializeComponent();
}


private void TreeView_MouseDown( object sender, MouseEventArgs e )
{
this.BeginUpdate();

if ( e.Button == MouseButtons.Right )
{
if ( (this.RMouseDownNode != null) &&
(this.RMouseDownNode.TextBounds.Contains( this.LastMousePositionToClient() )) )
{
this.SelectedNode = this.RMouseDownNode;
}
else
this.SelectedNode = null;
}
}

private void TreeView_MouseUp( object sender, MouseEventArgs e )
{
this.EndUpdate( true );
}
}

1 Reply

JJ Jisha Joy Syncfusion Team October 10, 2007 05:10 AM UTC

Hi David,

Thank you for your interest in Syncfusion Products.

The problem is because of the improper usage of BeginUpdate method. When you call the BeginUpdate method it will suspend the painting of control, so the process for expanding the node will not be performed. If you want to suspend the painting on right click then BeginUpdate method should be called after checking the MouseButton.

Please refer the sample from the below link that illustrate this.
Please refer the sample in the link to illustrate this:

rel='nofollow' href="
http://websamples.syncfusion.com/samples/Tools.Windows/68830/main.htm">http://websamples.syncfusion.com/samples/Tools.Windows/68830/main.htm

Please let me know if you have any questions.

Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon