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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ParentBarItem and CloseOnClick property

Thread ID:

Created:

Updated:

Platform:

Replies:

57214 Feb 27,2007 04:25 PM Mar 29,2007 03:43 PM Windows Forms 5
loading
Tags: Tools
Nik
Asked On February 27, 2007 04:25 PM

The documentation contains a great example of how this property can be used to create a menu containing BarItems that can be checked.

However, what if I want to mix checkable items with items that behave normally (i.e. they close the menu when they are clicked)?

Below i have extended the example to illustrate my point...

private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
PopupMenu popup = new PopupMenu();
ParentBarItem parentItem = new ParentBarItem();
parentItem.CloseOnClick = false;

barItem1.Checked = true;
barItem1.Click += new EventHandler(ItemChecked);
barItem2.Click += new EventHandler(ItemClicked);

parentItem.Items.Add(barItem1);
parentItem.Items.Add(barItem2);

popup.ParentBarItem = parentItem;
popup.Show(this, new Point(e.X, e.Y));
}
private void ItemChecked(object sender, EventArgs e)
{
BarItem itemClicked = sender as BarItem;
itemClicked.Checked = !itemClicked.Checked;
}
private void ItemClicked(object sender, EventArgs e)
{
// Perform Action...

// CLOSE MENU ?
}

Golda Rebecal [Syncfusion]
Replied On February 28, 2007 09:28 AM

Hi Nik,

We can use the Hide method of the PopupMenu to avoid showing the popup after an item is clicked.

Please have a look at the attached sample and let me know if this meets your requirement.

Thanks for your interest in Syncfusion products.

Best Regards,
Golda

CS52.zip

Nik
Replied On March 1, 2007 05:46 PM

Thanks for your example. Unfortunately it doesn't solve my problem :(

I should have been more explicit - the BarItems on which I require this behaviour are part of a ChildFrameBarManager. So they are shown via a MENU or a TOOLBAR rather than a PopupMenu.

Thanks for your continued assistance.

Nik

Golda Rebecal [Syncfusion]
Replied On March 5, 2007 09:31 AM

Hi Nik,

With the current implementation, when we set the CloseOnClick property to false for a parentbaritem that is hosted on a main menu or toolbar, it is not possible to close the popup menu.

Please let me know if you have any other questions.

Thanks for your interest in Syncfusion products.

Best Regards,
Golda

Golda Rebecal [Syncfusion]
Replied On March 12, 2007 07:49 AM

Hi Nik,

Sorry for the wrong update that I posted earlier.

It is possible to close the popup menu when a particular child baritem is clicked and not for other by using the CloseOnClick property of the ParentBarItem.

Please have a look at the attached sample and let me know if you need any further assistance.

Thanks for your interest in syncfusion products.

XPMenu

Best Regards,
Golda

Nik
Replied On March 29, 2007 03:43 PM

That's great! Thanks for your help

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;