RibbonGallery - ColumnCount

Ribbon for WPF Forum

Posted 13 years ago by jeff jarrell
1)I have a ribbon gallery that has a dynamic number of items. I currently have this defined in a user control that has a viewModel (to get the items).

My problem is that the ribbonGallery.ColumnCount is always 3. Even if I have two items or 10 items. Say I have 5 items, there is room, but it won't go wide enough.

2)Has any progress been made on making more rows viewable in the ribbon gallery (in-ribbon)?


Comments (3)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Jeff,

1) Can you make a simple sample project that shows this issue and email it over? Thanks!

2) Sorry this hasn't been done yet.

Actipro Software Support

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Jeff,

Thanks for the sample. There are a couple things to point out:

1) You were using MaxWidth for the RibbonGallery but that is bad. Our RibbonGallery auto-sizes based on its current variant size and the size of its items. So instead of MaxWidth to constrain the gallery, use this sort of code:
gallery.MediumVariantColumnCount = 3;
gallery.LargeVariantColumnCount = 10;
gallery.VariantBehavior = RibbonGalleryVariantBehavior.NoCollapseNoAutoSize;
Then you'll have a really slick effect where as you make the window wider, it will grow and show more items as they fit. The VariantBehavior setting above prevents it from growing to infinity. You may want to change that option so that it does grow and use all available space. But see the documentation for more information on how the various variants for RibbonGallery behave. You really can do a lot with them when combined with other groups.

2) Your other question in the email was, how can you get items to show better in the drop-down. In your XAML you had put a ribbon:Menu where you should have placed a ribbon:PopupGallery in the RibbonGallery.PopupContent.

If you swap this code in the PopupContent, it looks great (there is code like this in our demos too so you may want to look at those):
<ribbon:PopupGallery InitialColumnCount="4" 
    ItemTemplate="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ribbon:RibbonGallery}}, Path=ItemTemplate}"
    ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ribbon:RibbonGallery}}, Path=ItemsSource}"

Actipro Software Support

Posted 12 years ago by jeff jarrell
Great. Working now.

The latest build of this product (v21.1.1) 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.