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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to show mini tool bar and customizing popup menu at the same time?

Thread ID:

Created:

Updated:

Platform:

Replies:

143909 Apr 10,2019 08:51 AM UTC May 24,2019 01:15 PM UTC WinForms 15
loading
Tags: MiniToolBar
Rafal Pawlowski
Asked On April 10, 2019 08:51 AM UTC

Please see attached code.

When I try to show CustomizingPopupMenu and MiniToolBar at the same time, it doesn't work - CustomizingPopupMenu shows first, then MiniToolBar when I click on an item in CustomizingPopupMenu. I want to achieve similar behavior as there is in Microsoft Office which shows MiniToolBar over CustomizingPopupMenu at the same time. How can this be achieved?

Also it seems that setting location for CustomizingPopupMenu and MiniToolBar is inconsistently designed. In code, to align locations those two items, I had to call PointToScreen for MiniToolBar, but not for CustomizingPopupMenu.

Attachment: ToolBarPopupMenu_27392925.zip

Sabaridass Ramamoorthy [Syncfusion]
Replied On April 11, 2019 01:42 PM UTC

Hi Rafal 
  
Thank you for contacting Syncfusion Support. 
  
We have checked your reported requirement to open the CustomizingPopupMenu and MiniToolBar at the same time in your provided sample. On observing the sample, we have found that, you are calling the Show() method for Menu and then for MiniToolBar. Hence this method is invoked for each control one after to another and it results both the controls didn’t shown at same time.  
  
But you can achieve it by showing the MiniToolBar in PopupMenu BeforePopup event handler, but the lastly added items does not get focus. As per the default behavior of WinForms application,  only one control will be active at a time. 
 
Please download the sample for your reference. In this, we have achieved using BeforePopup event of CustomizedPopupMenu.  
 
  
Regards 
Sabaridass R 


Rafal Pawlowski
Replied On April 12, 2019 09:07 AM UTC

Hello,

Thank you for sample code and I see that mini tool bar and pop up menu are shown at once, but I do not understand why is mini tool bar grey as if it were disabled despite being enabled?

Sabaridass Ramamoorthy [Syncfusion]
Replied On April 15, 2019 12:07 PM UTC

Hi Rafal, 
Thanks for the update. 

As we mentioned in the previous update, according to the behavior of WinForms application,  only one control will be focused at a time. We would like to let you know that in your sample, both PopUpMenu and MiniToolBar visibility has been invoked one after one simultaneously. So focus will be set on PopupMenu by default, as it was shown last. Hence MiniToolBar is not accessible as reported.  

After further investigation, reported issue occurs  due to setting Visibility property of MiniToolBar as true. So, we suggest you to avoid handling visibility of MiniToolBar in code behind.  We have modified the sample based on this requirement and it can be downloaded from the following link. 

Sample: http://www.syncfusion.com/downloads/support/forum/143909/ze/MiniToolBar_PopupMenu_Sample1602939977

Please refer the below kb link for “How to display the MiniToolBar and ContextMenu controls at the same time”.

Link: https://www.syncfusion.com/kb/5782/how-to-display-the-minitoolbar-and-contextmenu-controls-at-the-same-time

Can you please check the above attached sample? and kindly let us know if it meets your requirement or if we have misunderstood your query. That will be helpful for us to analyze and provide prompt solution.  

Please let us know if you need further assistance.

Regards,
Sabaridass R 


Rafal Pawlowski
Replied On April 23, 2019 01:11 PM UTC

I was able to reproduce showing both pop up and conext menu at once using this sample.

My last question is:

Is it possible to get screen location and size of shown context menu directly so one can align pop up directly over it?

Sabaridass Ramamoorthy [Syncfusion]
Replied On April 24, 2019 11:44 AM UTC

HI Rafal, 
 
You can get the size and location of shown popup menu with the help of it’s child element. We have modified our working sample based on your requirement and it can be downloaded from below location. 
 
Kindly refer to the below code example. 
 
private void Menu_Popup(object sender, EventArgs e) 
        { 
            MenuGrid menuGrid = (MenuGrid)menu.GetType().GetProperty("MenuGrid", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(menu, null); 
            if(menuGrid != null) 
            { 
                var menuLocation = menuGrid.PointToScreen(new Point(button1.Location.X + 80, button1.Location.Y)); 
                var menuSize = menuGrid.Size; 
                //MessageBox.Show("Menu Location is: " + " " + menuLocation.ToString() +  "///////" + "Menu Size is:" + " " + menuSize.ToString()); 
            } 
        } 
  
Regards, 
Sabaridass R 


Rafal Pawlowski
Replied On April 26, 2019 07:31 AM UTC

Thank you for answer,

I have one problem with the provided solutions.

As suggested, I am using BeforePopup event to show mini tool bar. I also need to take context menu real size to correctly position mini tool bar to context menu. Problem is on the first showing menuGrid.Height seems to be incorrect. It says it's 80, when in reality it's 500. That means if you drag window close to bottom of the screen, mini tool bar will be overlapped first time you show context menu.

Second and next showing show it correctly.

I attach an updated sample code to reproduce the issue. Right click to show context menu - it should also show tool bar over it in fixed distance.

Attachment: WindowsFormsApp2_updated_a89d427e.zip

Sabaridass Ramamoorthy [Syncfusion]
Replied On April 29, 2019 07:13 AM UTC

Hi Rafal, 

We are able to reproduce the reported issue in our side and we have requested our development team for further validation regarding this reported issue. We will get back to you with the prompt details on or before 2nd May, 2019. 

We appreciate your patience until then. 

Regards, 
Sabaridass R 


Rafal Pawlowski
Replied On May 6, 2019 06:32 AM UTC

Hello,

Is it possible to get an update since I was informed about getting details on May 2nd and it is May 6th today and I do not see any?

Subburaj Pandian Veluchamy [Syncfusion]
Replied On May 6, 2019 12:58 PM UTC

Hi Rafal,

Sorry for the inconvenience caused.

As we have focused on the Volume 1 SP1 release works currently. We have missed to check the reported issue within the timeline. Currently we have checked the reported issue with high priority. We will update the prompt details on or before 8th May, 2019. We appreciate your patience until then. 
 
Regards,
Subburaj Pandian V  


Thirupathi Bala Krishnan [Syncfusion]
Replied On May 8, 2019 01:57 PM UTC

Hi Rafal,

Currently we have checked the reported issue by debugging with our source projects. Due to complexity, we need some more time to analyze the reported problem in our end. So we will provide the prompt details on or before 10th May, 2019 without any further delay.

We appreciate your patience until then.

Regards,
Thirupathi B. 


Thirupathi Bala Krishnan [Syncfusion]
Replied On May 10, 2019 02:05 PM UTC

Hi Rafal,

Thanks for your patience.

 
We are able to reproduce the reported issue – “PopupMenu height is not proper for the first time in BeforePopup event”. Due to some technical difficulties we are unable to create a private feedback for the reported issue. We will create and share the same on 13th May, 2019. 

Would waiting for the official release is OK for you? Otherwise, we can provide a patch on May 31, 2019.

Regards,
Thirupathi B.
 


Rafal Pawlowski
Replied On May 10, 2019 02:09 PM UTC

Hello,

I would prefer patch, though if possible, I would like to get it before May 24th, because we are implementing feature that depends on it and on May 31st we are supposed to have an official release for application with this feature.

Sabaridass Ramamoorthy [Syncfusion]
Replied On May 13, 2019 11:29 AM UTC

Hi Rafal,

Thanks for the update.

As per your request, we will provide the patch file for the reported issue on May 23, 2019. We appreciate your patience until then.

Regards,
Sabaridass R
 
 


Rafal Pawlowski
Replied On May 24, 2019 06:38 AM UTC

Hello,

Any updates on the patch?

Thirupathi Bala Krishnan [Syncfusion]
Replied On May 24, 2019 01:15 PM UTC

Hi Rafal,      
      
Thanks for your patience.      
      
We have fixed the reported issue –“MenuGrid height values are returned incorrectly”. As per current behavior, you can get the menu grid height value using the GetSize method. You must invoke the method inside the “Popup” event handler.

Please find the modified sample from the following location:
 
#MainWIndow.xaml.cs

        private void Menu_Popup(object sender, EventArgs e) 
        { 
            Size _size = menu.GetSize(); 
            this.label1.Text = "menuGrid.Height = " + _size.Height.ToString(); 
        }

private void panel1_MouseClick(object sender, MouseEventArgs e) 
        { 
            if (e.Button == MouseButtons.Right) 
            { 
                menu = new CustomizingPopupMenu(); 
                menu.ParentBarItem = new Syncfusion.Windows.Forms.Tools.XPMenus.ParentBarItem(); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item2" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item3" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item4" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item5" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item2" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item3" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item4" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item5" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item2" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item3" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item4" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item5" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item2" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item3" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item4" }); 
                menu.ParentBarItem.Items.Add(new BarItem() { Text = "item5" }); 
                menu.Popup += Menu_Popup; 
                this.location = new Point(e.X, e.Y); 
                menu.Show(this.panel1, location); 
            } 
        } 
 
 
Please find the patch file from the following location:      
      
V17.1.0.47 
Recommended approach – exe will perform automatic configuration           
Please find the patch setup here:                                 
       
Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment                            
Please find the patch assemblies alone from:            
        
Please find the Nugets from the below location:           
          
           
NOTE
You can change how you receive bug fixes by navigating to the following link and updating your preferences.
https://www.syncfusion.com/support/directtrac/patches
        
         
Disclaimer:                          
Please note that we have created this patch for the version 17.1.0.47 specifically to resolve the issues reported in this incident #143909. If you have received other patches for the same version for other products, please apply all patches in the order received. This fix will be included in our Volume 2 release which will be available in June 2019.   
 
Regards,
Thirupathi B.
 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon