/// <summary>
        /// Helper function for replacing regular tabs with a list box, like in
        /// the new Microsoft Office option dialogs.
        /// </summary>
        protected void PutTabNavigationToListView(
            MyXtraTabControl tabControl,
            ListBoxControl listControl)
        {
            tabControl.SelectedTabPageIndex = 0;
            tabControl.ShowTabHeader        = DefaultBoolean.False;

            // 2011-04-12, Uwe Keim: No border around the group boxes.
            tabControl.BorderStyle       = BorderStyles.NoBorder;
            tabControl.BorderStylePage   = BorderStyles.NoBorder;
            tabControl.LookAndFeel.Style = LookAndFeelStyle.Flat;
            tabControl.LookAndFeel.UseDefaultLookAndFeel = false;

            listControl.Items.Clear();

            foreach (MyXtraTabPage tabPage in tabControl.TabPages)
            {
                var args = new WantPutTabPageToNavigationListViewEventArgs(tabPage);
                OnWantPutTabPageToNavigationListView(args);

                if (!args.Cancel)
                {
                    listControl.Items.Add(new TabListItemInfo {
                        TabPage = tabPage
                    });
                }
            }

            listControl.SelectedIndexChanged +=
                delegate
            {
                RefreshTabNavigationFromSelection(tabControl, listControl);
            };

            ConnectTabControlInitializingEvents(tabControl);

            // --

            tabControl.TabStop = false;

            tabControl.KeyDown +=
                delegate(object sender, KeyEventArgs e)
            {
                // Forbid tabbing through.
                if (e.KeyCode == Keys.Tab && e.Control)
                {
                    e.Handled = true;
                }
            };
        }
 protected void RefreshTabNavigationFromSelection(
     MyXtraTabControl tabControl,
     ListBoxControl listControl)
 {
     if (listControl.SelectedItem == null)
     {
         tabControl.SelectedTabPageIndex = 0;
     }
     else
     {
         var info = (TabListItemInfo)listControl.SelectedItem;
         tabControl.SelectedTabPage = info.TabPage;
     }
 }
        protected void ConnectTabControlInitializingEvents(
            MyXtraTabControl tabControl)
        {
            tabControl.SelectedPageChanging +=
                delegate(object sender, TabPageChangingEventArgs e)
            {
                if (!_shownTabPages.Contains(e.Page))
                {
                    _shownTabPages.Add(e.Page);

                    OnInitializeTabPage(
                        new InitializeTabPageEventArgs(e.Page));
                }
            };
        }