Application Menu - blurring icons

Ribbon for WPF Forum

Posted 17 years ago by Siegfried Kreutzer - Ecolog GmbH
Version: 1.0.0348
Hello ActiPro Supportteam,

I have a problem with icons at the application menu.
If I create a button in xaml and set the ImageSourceLarge property, the image is displayed fine and sharp.

like in this code:

... used namespace ...

<ribbon:SplitButton ImageSourceLarge="/Images/SaveAs32.png" Label="Save As" KeyTipAccessText="A">
   <ribbon:Separator Label="Save settings under a different name" />
   <ribbon:Button ImageSourceLarge="/Images/SaveAs32.png" Label="Save As..."  KeyTipAccessText="A" />
But if I try to do this in code-behind the image is very blurry.
like in this code:

using Button=ActiproSoftware.Windows.Controls.Ribbon.Controls.Button;
private Button saveAsMenu = new Button();
saveAsMenu.Label = "Save Configuration as";
saveAsMenu.ImageSourceLarge = new BitmapImage(new Uri("Images/SaveAs32.png", UriKind.Relative));
saveAsMenu.Command = WorkItem.Items.AddNew<SaveAsStorageConfigCommand>();
Do you have any idea how to get also a sharp icon by using code-behind?

thanks in advance

Comments (3)

Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
It shouldn't really matter how you add content. We have SnapsToDevicePixels set on all our controls. However even with that set, I have seen cases in WPF (even not using our controls) where it seems like that value is ignored. Those cases lead me to think there is a small bug in WPF related to this. However if you would like to provide a sample that we can paste into our sample project or a sample project of your own that shows it, we'd be happy to take a look to see if any workaround ideas come to mind.

Actipro Software Support

Posted 10 years ago by Thomas Wiede - Noxum


this topic is old, but we have a similar problem with the small icons.

The Large Icons are sharp, the small blurry. For the small we use png format with 16x16 pixel.

To solve this in our old ToolBar Applications we have to set the attached property RenderOptions.BitmapScalingMode to NearestNeighbor.
does not work for us. 

Is there a possiblity to set this attached property at images in the Ribbon? The Style below does not work.

  <Style TargetType="Image">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="RenderOptions.BitmapScalingMode" Value="NearestNeighbor"/>
Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA

Hi Thomas,

We done a lot of work in the past years to make sure all the icons align on pixel bounds so that there isn't any anti-aliasing going on.  If you are seeing this problem in our samples, please let us know which one.  Otherwise, please make a new simple sample project that shows it and email that to our support address.  Reference this thread and rename the .zip file extension so it doesn't get spam blocked.  Thanks!

Actipro Software Support

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

Add Comment

Please log in to a validated account to post comments.