This project is read-only.

Issue with image/icon on a button

Oct 3, 2011 at 4:25 PM

Hi All,

For some reason, I couldn't show an image/icon on a button that's in the main ribbon... Strangely the image or icon shows up in the toolbar for the same button.

        Dim ribbon As New Fluent.Ribbon
        ribbon.Name = "Ribbon"

        Dim tab As New RibbonTabItem
        tab.Header = "aTab"

        Dim group As New RibbonGroupBox
        group.Header = "aGroup"

        Dim button1 As New Button
        button1.Header = "Button1"
        button1.Icon = GetImageSource("/Images/test.png")  'No image in ribbon, toolbar shows image on button
        'button1.Icon = GetBitmapFrame("/Images/test.png")  'No image in ribbon, toolbar shows image on button
        'button1.Icon = "/Images/myImage.png"    'No Image on ribbon, no image on toolbar

        Dim qami As New QuickAccessMenuItem
        qami.Header = "QAMI"
        qami.IsChecked = True
        qami.Target = button1


    Private Function GetImageSource(ByVal imageName As String) As ImageSource
        Return New BitmapImage(New Uri(imageName, UriKind.Relative))
    End Function
    Private Function GetBitmapFrame(ByVal imageName As String) As BitmapFrame
        Dim streamResourceInfo As StreamResourceInfo = Application.GetResourceStream(New Uri(imageName, UriKind.Relative))
        Return BitmapFrame.Create(streamResourceInfo.Stream)
    End Function
I will appreciate if anyone could shed some light on this or help me out... Many thanks..

Nov 15, 2011 at 10:23 AM


I remembered having the same problem: Images must be 96dpi. 

Hope it fixes things