.NET 4.0 TextOptions.TextFormattingMode truncates tab labels

Ribbon for WPF Forum

Posted 15 years ago by Jonesy
Version: 9.1.0507
Platform: .NET 4.0
Environment: Windows 7 (64-bit)
.NET 4.0 TextOptions.TextFormattingMode="Display" truncates tab labels on both left and right edges?

Comments (5)

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

Can you please post a very simple RibbonWindow XAML that makes it happen? Either that or email us a simple sample project that shows it. We didn't see any issues on an initial quick test here. Thanks.

Actipro Software Support

Posted 14 years ago by Cameron MacFarland - Senior Software Engineer, Orelogy Geotechnical
I've just noticed the same thing in build 507.

Here's a sample app that shows the problem.
<ribbon:RibbonWindow x:Class="WpfApplication1.MainWindow"
        Height="600" Width="800">
        <ribbon:Ribbon DockPanel.Dock="Top">
                <ribbon:Tab Label="Home" />
                <ribbon:Tab Label="Validation" />
                <ribbon:Tab Label="Storage" />
            Notice how the longer tabs are cut off.
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Cameron,

Thank you for the sample, we have corrected this issue for the next maintenance release.

Actipro Software Support

Posted 14 years ago by Ramon de Klein - The Netherlands
The problem also occurs when you change the default fontsize of the TextBlock style. Use the following XAML code:
<ribbon:RibbonWindow x:Class="Pallas.GUI.TestWindow"
    <DockPanel LastChildFill="True">
        <ribbon:Ribbon DockPanel.Dock="Top">
            <ribbon:Tab Label="Algemeen"/>
            <ribbon:Tab Label="A very, very long tab title"/>
Modify TestWindow's constructor to change the default TextBlock fontsize (I know, this is not the most elegant method):
public TestWindow()
  Style defaultTextBlockStyle = new Style() { TargetType = typeof(TextBlock) };
  defaultTextBlockStyle.Setters.Add(new Setter(TextBlock.FontSizeProperty, (double)20));
  Application.Current.Resources.Add(typeof(TextBlock), defaultTextBlockStyle);

When you run the application, then you'll see that the tabs are truncated (.NET v3.5). Is this issue also resolved in the next maintenance release and could you indicate when it will be released?

For people with source-code. The following changes to line 557+558 of ActiproSoftware.Windows.Controls.Ribbon.Controls.Tab fixes the problem:
Typeface typeface = new Typeface(this.LabelControl.FontFamily, this.LabelControl.FontStyle, this.LabelControl.FontWeight, this.LabelControl.FontStretch);
FormattedText text = new FormattedText(this.Label, CultureInfo.CurrentCulture, this.LabelControl.FlowDirection, typeface, this.LabelControl.FontSize, Brushes.Black);
During measurement, the TextBlock font properties were not used, but the properties of the Tab.

[Modified at 12/11/2009 07:22 AM]
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Ramon,

Yes this should be resolved in the next release. We hope to have the next release out in the next week or so.

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.