Menu separator does not display image

Ribbon for WPF Forum

Posted 7 years ago by Chris Bunker
Version: 11.2.0551
Platform: Silverlight Controls
Environment: Windows 7 (64-bit)
Avatar

If I attempt to add an image to a Separator, the image does not display.   I'd like to display the separator along with a label and image.   The documentation makes it appear that this is a supported case, because the Separator provides both ImageSourceSmall and ImageSourceLarge properties.  Here's the code I'm using to set the image...

 

<ribbon:Menu x:Key="MenuX">
    <ribbon:Separator Label="Test"  ImageSourceSmall="pack://application:,,,/MyLibrary.UI;component/Images/Large/Image.png"/>
    <ribbon:Button Label="X" ImageSourceSmall="pack://application:,,,/MyLibrary.UI;component/Images/Large/Image.png"/>
</ribbon:Menu>

 

Notice that the Button element below the separator DOES show the image, so I know there is nothing wrong with loading the image.   Am I missing something?

 

Thanks

Comments (3)

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

Hi Chris,

I'm sorry but our menu context template for Separator doesn't render images.  You'd need to provide a custom template for it to do that.


Actipro Software Support

Posted 7 years ago by Chris Bunker
Avatar

Thanks for the help.  After writing the default template to a file, it took some time to wade through the 6 or 7 control templates that are used depending upon the values of triggers.  I finally figured out which one was being used and updated it to add an image.  Is this the recommended approach?  If so, I'd recommend adding this process of creating custom control templates from the defaults to some FAQ, because it's not a trivial thing to do, in my opinion.

Chris

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

Yes, you can just set the Template property in XAML for that particular item, or create a reusable ControlTemplate resource in your App Resources for it and reference that.


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.