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
close icon

Not able to access individual baritem from Menu Grid

Team,
I have a popup menu added for our syncfusion data Grid right click option.
When we spy the menu object. We can access only Syncfusion.Windows.Forms.Tools.XPMenus.MenuGrid , Syncfusion.Windows.Forms.Tools.XPMenus.MenuGridHost. Object.
Could you please help me on how to access individual bar item from menu Grid .
Could you please guide me with property or method in menugrid to access baritems.
thanks in advance
.
Srini

3 Replies

SK Senthil Kumaran Rajan Syncfusion Team September 29, 2014 12:53 PM UTC

Hi Srinivasan,

 

Thank you for using Syncfusion products,

 

We would like to let you know that we can access the BarItem  as shown in the below code snippet and also we have prepared a sample for your reference and it is attached below.

 

Code Snippet[C#]:

popupMenu1.ParentBarItem.Items[0].Click += new EventHandler(Form1_Click);

void Form1_Click(object sender, EventArgs e)

        {

            MessageBox.Show((sender as BarItem).Text.ToString());       

        }

 

 

Please let us know if you need further assistance,

 

Regards,

R.Senthil kumaran


Attachment: MenuGrid_e0da349c.zip


SR Srinivasan September 29, 2014 02:04 PM UTC

Good Day!!!

Thank you Senthil for your inputs.

We are trying to do test automation for syncfusion menu Grid. We cannot register event handler to get baritem instance.

Right now I can access MenuGrid and MenuGridHost object.  How can i access List values added in menu Grid . Do we have any class level properties or methods in MenuGrid or MenuGridHost that returns List

My requirement is to retrive individual bar item and to invoke click event on it.

Thanks in advance

Regards,
Srini


AJ Ashwini Jaya Preetha Durai Samy Syncfusion Team September 30, 2014 11:10 AM UTC

Hi Srinivasan,

 

Thanks for  your update,

 

As we have explained in our previous update, In PopupMenu child BarItems collection is maintained its ParentBarItem Items collection. Each of BarItem can be accessed from its Items collection.

 

Code Snippet[C#]:

 

        //BarItem stored in Items collection        

        popupMenu1.ParentBarItem.Items[0].Click += new EventHandler(Form1_Click);

        void Form1_Click(object sender, EventArgs e)

        {

            MessageBox.Show((sender as BarItem).Text.ToString());       

        }

 

 

If we have misunderstood your query, can you please share us more details about this requirement? That will be helpful for us to analyze and provide you a prompt solution.

 

Regards,

Ashwini


Loader.
Live Chat Icon For mobile
Up arrow icon