How to set max length of tab title?

Docking/MDI for WPF Forum

Posted 6 months ago by Yuki
Version: 23.1.3
Avatar

Hello,

In our application, document window's title is long sometimes.

For example, when "Document Window (Created at 2023/10/27)" is set to title, "Document Window (Cre... at 2023/10/27)" is displayed actually.

We would like to display whole title text at tab of document window.

Would you please tell me how to do it?

Comments (3)

Posted 6 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

You should be able to adjust the TabbedMdiHost.MaxTabExtent property to a larger value to accommodate the maximum width you would like.


Actipro Software Support

Posted 5 months ago by Yuki
Avatar

Hello,

Thank you for your reply.

Though I had already tried to set TabbedMdiHost.MaxTabExtent property, length of tab title was not changed.

I will send sample project.

Would you please check it and advice me?

Answer - Posted 5 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

The TabbedMdiHost.MaxTabExtent property does allow the tab to grow to larger size, but we also should have mentioned that there is a special TitleConverter value converter in place on the binding for the TextBlock that will only allow up to a certain number of characters to show.  If the number of characters exceeds specifications, ellipses will be inserted in the middle of the text.  That's what's happening here.  We had to use a custom value converter since TextBlock can't do character ellipses in the middle of the text (like we generally want in this scenario).  TextBlock only supports character ellipses at the end.

If you use this code for your TabbedMdiHost, it will work how you want since this TextBlock.Text binding doesn't use our value converter:

<docking:TabbedMdiHost MaxTabExtent="100000">
  <docking:TabbedMdiHost.TabItemContainerStyle>
    <Style TargetType="docking:AdvancedTabItem">
      <Setter Property="Header" Value="{Binding TabTextResolved}" />
      <Setter Property="HeaderTemplate">
        <Setter.Value>
          <DataTemplate>
            <TextBlock Text="{Binding}" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap" VerticalAlignment="Center" />
          </DataTemplate>
        </Setter.Value>
      </Setter>
    </Style>
  </docking:TabbedMdiHost.TabItemContainerStyle>
  ...


Actipro Software Support

The latest build of this product (v24.1.2) was released 4 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.