Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

Custom XtraTabbedMdiManager - How to add a button showing MDI child windows list to the XtraTabbedMdiManager's header

$
0
0

This sample shows how to add a button showing MDI child windows list to the XtraTabbedMdiManager's header. A button like "Active Files" in Visual Studio. To accomplish this, we've created an XtraTabbedMdiManager descendant along with descendants of other classes like the TabHeaderViewInfo and TabButtonsPanel. Also, since we cannot make changes to the Enums, we cannot extend the buttons set available in the HeaderButtons property. So, a separate property controlling this button's visibility has been added - HeaderShowActiveFilesButton. It has the bool type and by default is set to false.

Question Comments

Added By: Mike Liu at: 11/1/2013 11:35:55 AM    

Hi I downloaded this example, and ran it, but I didn't see the button on the tab manager header. Where is the button?

Added By: JJDX at: 9/21/2014 11:12:23 AM    

Same here, dl, run but no buttons, i search for HeaderShowActiveFilesButton , change it to true but there is no button still.

Added By: Yaroslav (DevExpress Support) at: 9/22/2014 6:24:58 AM    

Hi Roman,
This example was created long time ago, so some internal methods have been changed since that time. I slightly updated the target project (both C# and VB.NET versions) in order to fix the aforementioned issue. Now an additional button is displayed as expected under the latest 14.1 version.
Don't hesitate to contact us in case of any difficulty. 

Added By: Christian Tüber at: 12/7/2015 11:50:34 PM    

I modified the example to have a feature toggle button. I set a super tool tip for the EditorButton but it is not shown.
Do i have to assign it to the RibbonControl on the XtraForm to get it running?

Here my code example:
     protected override TabButtonInfo CreateButton(TabButtonType button)
     {
        if ( button == TabButtonType.User )
        {
            ButtonPredefines predefine = ButtonPredefines.Glyph;
               Boolean selectedPageIsAFavorite = false;
               if (this.TabViewInfo.SelectedTabPage != null && this.TabViewInfo.SelectedTabPage is XtraMdiTabPage)
               {
                   XtraMdiTabPage mdiTabPage = (XtraMdiTabPage)this.TabViewInfo.SelectedTabPage;
                   if (    mdiTabPage.MdiChild != null &&
                           mdiTabPage.MdiChild.ParentForm != null &&
                           mdiTabPage.MdiChild.ParentForm is MainForm)
                   selectedPageIsAFavorite = ((MainForm)mdiTabPage.MdiChild.ParentForm).IsSelectedPageAFavorite((Form)mdiTabPage.MdiChild);
               }
               SuperToolTip superToolTipForFavoriteToggleButton = new SuperToolTip();
               SuperToolTipSetupArgs args = new SuperToolTipSetupArgs();
               args.Title.Text = "Favorit setzen/löschen";
               Image favoriteGlyph = null;

               if (selectedPageIsAFavorite)
               {
                   // page is a favorite
                   args.Contents.Text = "Anklicken zum Löschen des Favoritenstatus";
                   favoriteGlyph = Properties.Resources.ov_favorite_active;
               }
               else
               {
                   // page is NOT a favorite
                   args.Contents.Text = "Anklicken zum Setzen des Favoritenstatus";
                   favoriteGlyph = Properties.Resources.ov_favorite_non_active;
               }

               superToolTipForFavoriteToggleButton.Setup(args);
               EditorButton favoriteButton = new EditorButton(predefine, favoriteGlyph, superToolTipForFavoriteToggleButton);
               TabButtonInfo tabBtn = new TabButtonInfo(favoriteButton, button);
           return tabBtn;
        }

        return base.CreateButton(button);
     }


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>