Application Menu - blurring icons

Ribbon for WPF Forum

Posted 11 years ago by Siegfried Kreutzer - Ecolog GmbH
Version: 1.0.0348
Avatar
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 ...
xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon"
...

<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" />
</ribbon:SplitButton>
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>();
WorkItem.UIExtensionSites[UIExtensionSiteNames.SaveAsCommands].Add(saveAsMenu);
Do you have any idea how to get also a sharp icon by using code-behind?

thanks in advance
Siegfried

Comments (3)

Posted 11 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
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 5 years ago by Thomas Wiede - Noxum
Avatar

Hello,

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.
SnapsToDevicePixels
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.

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

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 (v2018.1 build 0675) 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.