How to add a hamburger button in the MetroForm Caption bar

I am using a MetroForm with a Drawer menu. 

To show/hide the menu, I would like add a hamburger button in the caption bar of the form. 

I can add a CaptionImage, but I cannot find how to catch the onClick event. 


1 Reply

SB Sweatha Bharathi Syncfusion Team February 6, 2025 01:54 PM UTC

Hi  Patrick de Vos ,

We have reviewed your query and we do not have support to add UserControl in the CaptionBar of MetroForm. Based on our understanding, instead of using a control, you can add an image. We have added a hamburger menu image to the caption bar and implemented functionality to show or hide the menu using the ImageMouseDown event. You can capture the image click by handling this event.

We have provided a sample for your reference. Kindly review it and let us know if you have any concerns.

Code snippet :

 private void CaptionImage1_ImageMouseDown(object sender, ImageMouseDownEventArgs e)
 {
     if (isContextMenuVisible)
     {
         contextMenu.Hide();
         isContextMenuVisible = false;
     }
     else
     {
         contextMenu.Show(this, e.Location);
         isContextMenuVisible = true;
     }
 }




Regards,
Sweatha.B

Attachment: MetroFormSample_eac27e72.zip

Loader.
Up arrow icon