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

ParentBarItem - Selected item

I have ParentBarItem with several items, how do i know which item is currently selected?

Thanks 
Shiri T

1 Reply

SK Senthil Kumaran Rajan Syncfusion Team June 5, 2015 10:42 AM UTC

Hi Shiri,

Thank you for using Syncfusion products.

This reported requirement can be achieved by handling below events.

·         MouseDown – This event triggers when user click on the ParentBarItem.

·         Selected – This Event triggers when the user selects a ParentBarItem using Mouse or Keyboard.

·         ItemClicked – This Event fires when user click on the BarItem

Please make use of the code snippets given below for your reference. We have also prepared a sample for your reference that can be downloaded from the following location.

Code Snippet[C#]:

   //This event triggers while we click on any parentBarItems in MainFrameBarManager

        void ParentBarItem_MouseDown(object sender, MouseEventArgs e)

        {

            if (sender is ParentBarItem)

                listBox1.Items.Add((sender as ParentBarItem).Text);

        }


        //It is handled when the user selects a BarItem during menu navigation using mouse or keyboard.        

        void ParentBarItem_Selected(object sender, EventArgs e)

        {

              if (sender is ParentBarItem)

                listBox1.Items.Add((sender as ParentBarItem).Text);

        }


        void mainFrameBarManager1_ItemClicked(object sender, Syncfusion.Windows.Forms.Tools.XPMenus.BarItemClickedEventArgs args)

        {

            //ItemClicked event get triggered when we select any BarItem in MainFrameBarManager

            listBox2.Items.Add(args.ClickedBarItem.Text);

        }


Sample Location : http://www.syncfusion.com/downloads/support/directtrac/139886/ze/CheckParentBarItem-1414253171

Please refer the below UG documentation link for your further reference.

UG Link : http://help.syncfusion.com/ug/windows%20forms/index.html#!Documents/eventsofparentbaritem.htm

Could you please check with the above solution and let us know if it matches your requirement? Otherwise please share us more details about this reported requirement. That will be helpful for us to analyze and provide prompt solution as earlier as possible.

Please let us know if you need further assistance.

Regards,
Senthil

Loader.
Live Chat Icon For mobile
Up arrow icon