How to collapse the TabStrip

Docking/MDI for WPF Forum

Posted 2 years ago by Moondance
Version: 17.1.0651
Avatar

I have a docksite with a workspace in the middle that is a tabmdi control

I would like, under certain circumstances, to collapse the tabstrip and the small drop down menu that list all the tabs available.

I found the IsTabStripVisible property but by setting it to false it simply hides the tabstrip and the dropdown control to the right is still there.

How can I collapse both the tabs and the dropdown control?

Thank you.

Comments (10)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

One option if you have no documents open or want to even hide the selected document's content is to set the TabbedMdiHost's Visibility to Collapsed.

Or if you want to do what you are already doing and hide the overflow too, then change the TabbedMdiHost.TabOverflowBehavior to None.


Actipro Software Support

Posted 2 years ago by Moondance
Avatar

Thabk you. Setting the TabOverflowBehavior did it.

Posted 2 years ago by Ian Newborn
Avatar

Did the access level of the IsTabStripVisible property change recently?  I'm looking at it and it's protected in 16.1.635.0

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Ian,

I don't think so.  On AdvancedTabControl it is totally public.  On DockingWindowContainerBase (base class of TabbedMdiContaioner and ToolWindowContainer), it has a protected setter.


Actipro Software Support

Posted 2 years ago by rex hui
Avatar
<docking:Workspace>
   <docking:TabbedMdiHost TabOverflowBehavior="None" >          
      <docking:TabbedMdiContainer>
         <docking:TabbedMdiContainer.TabControlStyle>
            <Style TargetType="docking:AdvancedTabControl">
               <Setter Property="IsTabStripVisible" Value="False" />
            </Style>
         </docking:TabbedMdiContainer.TabControlStyle>
      </docking:TabbedMdiContainer>     
   </docking:TabbedMdiHost>
</docking:Workspace>

 I did this but the tab strip is still visible. What did I do wrong?

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

You never want to set properties (like TabControlStyle) specifically on any kind of container (e.g. TabbedMdiContainer, ToolWindowContainer) instance because those are transient controls that get created and destroyed on various layout changes.  Instead you need to set properties on higher-level objects like DockSite and TabbedMdiHost.  The properties there will be bound and passed down to active container controls like TabbedMdiControl.

In this case though, our container controls have programmatic logic that govern whether the tabstrip is visible and there isn't an easy way to disable that logic.

Why do you wish to collapse the tabstrip anyhow?  If you are going to do that, perhaps you could use something like maximized standard MDI instead?


Actipro Software Support

Posted 2 years ago by rex hui
Avatar

Thanks for explaining. The reason is because I want single document to have no tabs occupying the screen and only show the tabs when there are two or more documents opened.

BTW, I am not able to set the "MinTabExtent" and it looks like the sample browser program is not having a constant tab width either. Is this a bug?

Thank you.

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

As for the single tab hiding, that could become an issue if there were two tabbed documents and one was dragged underneath the other.  Then suddenly neither would have a tab visible, since the tab hiding is based on the number of visible windows is each container.

It does look like the Browser UI sample isn't using those properties correctly. I think at some point we added related properties on TabbedMdiContainer itself and those get bound down to set the AdvancedTabControl in the TabbedMdiContainer template. Thus setting those properties on AdvancedTabControl's Style won't do any good. They need to be set on an implicit TabbedMdiContainer Style instead.  We'll fix that sample in the next build.

If you add this implicit Style in your Application.Resources, it will make constant document tab widths:

<Style TargetType="docking:TabbedMdiContainer">
	<Setter Property="MinTabExtent" Value="200" />
	<Setter Property="MaxTabExtent" Value="200" />
</Style>


Actipro Software Support

Posted 2 years ago by rex hui
Avatar

Thanks, that works.

If I really want to set the IsTabStripVisible to false through AdvancedTabControl, how do I do that?

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

At the moment, since the tab strip visibility is determined by the containing TabbedMdiContainer but you have no real ability to intercept that logic, you would probably need to make a new implicit Style for TabbedMdiContainer in your Application.Resources that is a clone of our detault Style, and update the Template to not pass down the IsTabStripVisible setting to the AdvancedTabControl in the template.  You could bind that to some other attached property, but I still don't think there's a good way for you to identify all the scenarios when that IsTabStripVisible-related attached property would need to change.  From an external perspective, I'm not thinking there is a good way to accomplish this.


Actipro Software Support

The latest build of this product (v2019.1 build 0681) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.