Merge problem with ContextMenuItem in TabbedMdiManager
Hi, i'm using a TabbedMdiManager and im trying to replace the exixting contextmenu with one of my own. I'm using this code:
this._TabbedMDIManager.ContextMenuItem.MergeType = MenuMerge.Replace; this._TabbedMDIManager.ContextMenuItem.MergeItems(contextMenuItem);
But it adds my items to the contextmenu instead of removing the existing ones and adding the new ones (i have also tried using MenuMerge.Remove and it works the same).
How can i do this?
Thank you in advance,
Borja
this._TabbedMDIManager.ContextMenuItem.MergeType = MenuMerge.Replace; this._TabbedMDIManager.ContextMenuItem.MergeItems(contextMenuItem);
But it adds my items to the contextmenu instead of removing the existing ones and adding the new ones (i have also tried using MenuMerge.Remove and it works the same).
How can i do this?
Thank you in advance,
Borja
SIGN IN To post a reply.
7 Replies
GR
Golda Rebecal
Syncfusion Team
January 24, 2007 01:15 PM UTC
Hi Borja,
We can resolve this issue by first disposing the existing menu items in the ContextMenuItem of the TabbedMDIManager and then adding our own ContextMenuItem.
tb.ContextMenuItem.Items.Dispose();
tb.ContextMenuItem.MergeItems(contextMenuItem);
Please see the sample attached and let me know if this helps.
Thanks for your interest in Syncfusion products.
Regards,
Golda
tabbedmdi6.zip
We can resolve this issue by first disposing the existing menu items in the ContextMenuItem of the TabbedMDIManager and then adding our own ContextMenuItem.
tb.ContextMenuItem.Items.Dispose();
tb.ContextMenuItem.MergeItems(contextMenuItem);
Please see the sample attached and let me know if this helps.
Thanks for your interest in Syncfusion products.
Regards,
Golda
tabbedmdi6.zip
AD
Administrator
Syncfusion Team
January 24, 2007 02:57 PM UTC
Hi Golda,
Your solution works fine in your example, but there are a couple of wrong behaviors in my code (i have been able of reproducing it in the "browse samples" example of TabbedMdi that Syncfusion provides, so you can see in the attached file what is happening).
There are two things:
1.- When i have several tabs the context menu is the original one merged with the new one. If you close al the tabs but one the context menu is the new one.
2.- Even when there is only one tab the context menu contains the new bar items plus "Close" bar item.
I have compared the two examples (the one provided by syncfusion and the one you provide) but i can't tell what the difference is.
Thank you,
Borja
Your solution works fine in your example, but there are a couple of wrong behaviors in my code (i have been able of reproducing it in the "browse samples" example of TabbedMdi that Syncfusion provides, so you can see in the attached file what is happening).
There are two things:
1.- When i have several tabs the context menu is the original one merged with the new one. If you close al the tabs but one the context menu is the new one.
2.- Even when there is only one tab the context menu contains the new bar items plus "Close" bar item.
I have compared the two examples (the one provided by syncfusion and the one you provide) but i can't tell what the difference is.
Thank you,
Borja
AD
Administrator
Syncfusion Team
January 24, 2007 02:59 PM UTC
MU
Murugan
Syncfusion Team
January 24, 2007 07:14 PM UTC
Hi Borja,
Thanks for your sample.
Could you please try the following code snippet
this.tabbedMDIManager.ContextMenuItem.BeforePopup += new CancelEventHandler(ContextMenuItem_BeforePopup);
private void ContextMenuItem_BeforePopup(object sender, CancelEventArgs e)
{
tabbedMDIManager.ContextMenuItem.Items.Clear();
this.tabbedMDIManager.ContextMenuItem.MergeItems(contextMenuItem);
}
and let me know if it helps you.
Regards,
Murugan P.S
Thanks for your sample.
Could you please try the following code snippet
this.tabbedMDIManager.ContextMenuItem.BeforePopup += new CancelEventHandler(ContextMenuItem_BeforePopup);
private void ContextMenuItem_BeforePopup(object sender, CancelEventArgs e)
{
tabbedMDIManager.ContextMenuItem.Items.Clear();
this.tabbedMDIManager.ContextMenuItem.MergeItems(contextMenuItem);
}
and let me know if it helps you.
Regards,
Murugan P.S
AD
Administrator
Syncfusion Team
January 25, 2007 08:12 AM UTC
Hi Murugan,
Thanks for your code, but i'm sorre to tell that it neither worked in my code nor in the example from Syncfusion's browse samples.
Any other idea?
Borja
Thanks for your code, but i'm sorre to tell that it neither worked in my code nor in the example from Syncfusion's browse samples.
Any other idea?
Borja
GR
Golda Rebecal
Syncfusion Team
January 25, 2007 09:18 AM UTC
Hi Borja,
Could you please try the MergeItems method of the ParentBarItem to merge our menu after disposing the default items.
tabbedMDIManager.ContextMenuItem.MergeItems(contextMenuItem);
I have modified the sample you have provided. Please see the attached sample and let me know if this helps.
Thanks,
Golda
tabtest.zip
Could you please try the MergeItems method of the ParentBarItem to merge our menu after disposing the default items.
tabbedMDIManager.ContextMenuItem.MergeItems(contextMenuItem);
I have modified the sample you have provided. Please see the attached sample and let me know if this helps.
Thanks,
Golda
tabtest.zip
AD
Administrator
Syncfusion Team
January 29, 2007 08:16 AM UTC
Your solution works fine, thank you.
SIGN IN To post a reply.
- 7 Replies
- 4 Participants
-
BO Borja
- Jan 23, 2007 12:29 PM UTC
- Jan 29, 2007 08:16 AM UTC