问题
I just purchased some image collections for use with the WPF Ribbon control. The images are immaculate; however, they do not render correctly in the control.

Neither the small or large images are not rendered correctly. I've tried different image sizes but it doesn't seem to make any difference.
I have an array of different image sizes available. Here's a snippet of my XAML.
<RibbonTab Header="Edit">
<RibbonGroup Header="Clipboard">
<RibbonButton Label="Paste" LargeImageSource="Images\paste.png" ToolTipFooterTitle="" ToolTipImageSource="Images/paste_sm.png" ToolTipTitle="Paste" ToolTipDescription="Insert text from the clipboard at the current location"></RibbonButton>
<RibbonButton Label="Cut" SmallImageSource="Images\cut_sm.png" ToolTipDescription="Cut the selected text" ToolTipTitle="Cut" ToolTipImageSource="Images/cut.png"></RibbonButton>
<RibbonButton Label="Copy" SmallImageSource="Images\copy_sm.png" ToolTipDescription="Copy the selected text" ToolTipTitle="Copy" ToolTipImageSource="Images/copy.png"></RibbonButton>
<RibbonButton Label="Select All" ToolTipDescription="Select all text in document" ToolTipTitle="Select All"></RibbonButton>
</RibbonGroup>
</RibbonTab>
I'm new to WPF and am amazed that I have to struggle with issues like this.
Does anyone know how to make my images render correctly?
回答1:
Try a few different options for RenderOptions.BitmapScalingMode on the RibbonButtons. I've found that sometimes NearestNeighbor
works better. UseLayoutRounding="True"
may help as well.
来源:https://stackoverflow.com/questions/34475138/images-do-not-render-correctly-in-wpf-ribbon-control