ItemVariantSize on databound menu

Ribbon for WPF Forum

Posted 12 years ago by Jeff Jo
Avatar
I have two menus, one where buttons are specified inline in the XAML and one that is data-bound. For some reason, when I specify ItemVariantSize on the databound version, the menu items are small. Here is my xaml:

<ribbon:PopupButton Label="Items" Margin="5,0,5,0">
    <ribbon:Menu ItemVariantSize="Large">
        <ribbon:Button Label="Item1" ImageSourceLarge="images/item1.png"></ribbon:Button>
        <ribbon:Button Label="Item2" ImageSourceLarge="images/item2.png"></ribbon:Button>
    </ribbon:Menu>
</ribbon:PopupButton>
<!-- Databound version -->
<ribbon:PopupButton Label="Items2">
    <ribbon:Menu ItemVariantSize="Large"
                 ItemsSource="{Binding Source={x:Static Member=cp:Repository.Items}}">
        <ribbon:Menu.ItemTemplate>
            <DataTemplate>
                <ribbon:Button Label="{Binding Name}"
                               ImageSourceLarge="{Binding ImagePath}">
                </ribbon:Button>
            </DataTemplate>
        </ribbon:Menu.ItemTemplate>
    </ribbon:Menu>                        
</ribbon:PopupButton>
I tried specifying VariantSize="Large" on the ribbon:Button tags inside the DataTemplate, which makes the button heights larger, but that stacks the images and labels vertically. I would like images and labels displayed in a horizontal orientation. Any help would be greatly appreciated

[Modified at 02/10/2012 11:10 PM]

Comments (2)

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

If you add Context="MenuItem" then it should look correct:
<ribbon:Button VariantSize="Large" Context="MenuItem" ... />


Actipro Software Support

Posted 12 years ago by Jeff Jo
Avatar
Thanks - that did the trick!
The latest build of this product (v24.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.