.NET 4.0 TextOptions.TextFormattingMode truncates tab labels

Ribbon for WPF Forum

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

Comments (5)

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

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
Avatar
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"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
                     
        TextOptions.TextFormattingMode="Display"
                     
        Height="600" Width="800">
    <DockPanel>
        
        <ribbon:Ribbon DockPanel.Dock="Top">
            
            <ribbon:Ribbon.Tabs>
                
                <ribbon:Tab Label="Home" />
                <ribbon:Tab Label="Validation" />
                <ribbon:Tab Label="Storage" />
                
            </ribbon:Ribbon.Tabs>
            
        </ribbon:Ribbon>
        
        <Label>
            Notice how the longer tabs are cut off.
        </Label>
        
    </DockPanel>
</ribbon:RibbonWindow>
Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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
Avatar
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"
    xmlns="http://schemas.microsoft.com/netfx/2007/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
    Title="TestWindow">
    <DockPanel LastChildFill="True">
        <ribbon:Ribbon DockPanel.Dock="Top">
            <ribbon:Tab Label="Algemeen"/>
            <ribbon:Tab Label="A very, very long tab title"/>
        </ribbon:Ribbon>
    </DockPanel>
</ribbon:RibbonWindow>
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);

  InitializeComponent();
}
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
Avatar
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 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.