// When the btnListChildGroups button is clicked, the code probes all
        // ribbon groups in the selected tab and list them in the lbGroups list box.
        private void btnListChildGroups_Click(object sender, EventArgs e)
        {
            this.lbGroups.Items.Clear();

            // Find the selected tab.
            ListBoxItem item = this.lbTabs.SelectedItem as ListBoxItem;
            IAccessible tab  = MSAAHelper.GetAccessibleObjectByNameAndRole(
                this.TopWindow, new Regex(item.Name), "property page", true);

            if (tab == null)
            {
                MessageBox.Show("Error: the " + item.Name + " tab cannot be found");
                return;
            }

            // Get the groups, and list the groups in the lbGroups control.
            List <IAccessible> groups = new List <IAccessible>();

            MSAAHelper.GetAccessibleObjectListByRole(tab, "tool bar", ref groups, true);
            foreach (IAccessible group in groups)
            {
                this.lbGroups.Items.Add(new ListBoxItem(group.get_accName(0), group));
            }
        }