Blurred text when RibbonWindow is used with IsGlassEnabled = "true"

Ribbon for WPF Forum

Posted 7 years ago by AlexanderB - Software Developer, Edifecs
Version: 11.1.0545
Avatar

Hi,

We found that all the text in our window looks very blurred when we use RibbonWindow with "IsGlassEnabled" property set to "true". If "IsGlassEnabled" is initially "false" the text looks just great.

Please note that we are using .NET 4.0 with "UseLayoutRounding" property set to "true" and "TextOptions.TextFormattingMode" set to "Display".

I will send an e-mail with additional details, some screenshots on what we mean under "blurred text" and sample project where the problem can be reproduced.

Thanks,

Alexander.

Comments (4)

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

Hi Alexander,

I believe WPF is doing grayscale anti-aliasing there rather than ClearType because of the code we have to do to get RibbonWindow to render correctly.  If you set this on your root content element in the window, I think it will help:

RenderOptions.ClearTypeHint="Enabled"


Actipro Software Support

Posted 7 years ago by AlexanderB - Software Developer, Edifecs
Avatar

Thanks for your answer. It really looks like blurred text is rendered using "greyscale" anti-aliasing.

Setting ClearTypeHint="Enabled" helps for case when text is located inside RibbonWindow. But we found that if RibbonWindow contains DockSite, setting ClearTypeHint="Enabled" does not help to fix a text inside DockSite.

Our commercial product is RibbonWindow with DockSite placed within, so the problem is really significant for us.

Here is Xaml for modified sample (I will send complete demo project by mail as well just in case). 

<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:docking="http://schemas.actiprosoftware.com/winfx/xaml/docking"
		xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
		Title="MainWindow" Height="200" Width="400"
		Background="White"
		TextOptions.TextFormattingMode="Display"
		RenderOptions.ClearTypeHint="Enabled"
		UseLayoutRounding="True">

	<Window.Resources>
		<Style x:Key="Header" TargetType="TextBlock">
			<Setter Property="FontWeight" Value="Bold"/>
			<Setter Property="FontSize" Value="12"/>
			<Setter Property="Margin" Value="10 10 0 0"/>
		</Style>

		<Style  x:Key="Text" TargetType="TextBlock">
			<Setter Property="Margin" Value="10 0 0 0"/>
		</Style>
	</Window.Resources>

	<Grid>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*"/>
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="Auto"/>
		</Grid.RowDefinitions>

		<Grid Grid.Row="0">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto"/>
				<RowDefinition Height="Auto"/>
			</Grid.RowDefinitions>

			<TextBlock Grid.Row="0" Style="{StaticResource Header}">The quick brown fox jumps over the lazy dog</TextBlock>
			<TextBlock Grid.Row="1" Style="{StaticResource Text}">The quick brown fox jumps over the lazy dog</TextBlock>
		</Grid>

		<docking:DockSite Grid.Row="1" Background="White">
			<Grid RenderOptions.ClearTypeHint="Enabled">
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
				</Grid.RowDefinitions>

				<TextBlock Grid.Row="0" Style="{StaticResource Header}">The quick brown fox jumps over the lazy dog</TextBlock>
				<TextBlock Grid.Row="1" Style="{StaticResource Text}">The quick brown fox jumps over the lazy dog</TextBlock>
			</Grid>
		</docking:DockSite>
	</Grid>
</ribbon:RibbonWindow>
Answer - Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Alexander,

I think it might be because some of the controls in the DockSite template may have a Transparent background.  And ClearType won't render on transparent backgrounds.  If you set the Background property on your Grid in the docking:DockSite, it gets it working.


Actipro Software Support

Posted 7 years ago by AlexanderB - Software Developer, Edifecs
Avatar

Thank you! The reason really was a transpared background. The problem is resolved now.

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.