Using WPF MVVM'ish style. Trying to create a RibbonGallery with items that are clickable for some reason i cannot get the items to launch my delegate command
XAML CODE:
<RibbonMenuButton LargeImageSource="Images/DeleteUser1.png" Label="Delete">
<RibbonGallery>
<RibbonGalleryCategory ItemsSource="{Binding AvailibleUsers}" Header="User List">
<RibbonGalleryCategory.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image Source="Images/DeleteUser1.png" Width="25"/>
<ContentPresenter Content="{Binding}" Grid.Column="1">
<ContentPresenter.InputBindings>
<MouseBinding MouseAction="LeftClick" Command="{Binding CommandDeleteAllPermissions}"/>
</ContentPresenter.InputBindings>
</ContentPresenter>
</Grid>
</DataTemplate>
</RibbonGalleryCategory.ItemTemplate>
</RibbonGalleryCategory>
</RibbonGallery>
</RibbonMenuButton>
The datacontext has been set to a view model. ViewModel:
public DelegateCommand CommandDeleteAllPermissions { get { return new DelegateCommand(Delegated_DeleteAllPermissions); } }
private void Delegated_DeleteAllPermissions(object obj)
{
\\todo:stuff
}
i have tested this command using a standard button and it triggers, but using the specific XAML code i cannot get clickable items in my RibbonGallery control.
Any Ideas?
Galleries are some sort of categorized lists, whose items can be checked. They are suitable, when you need an options menu, where user should check/uncheck items:
This is the XAML for data-bound gallery and sample view model:
Here
GalleryItemsis a collection of these view models:If you need dropdown menu to execute some commands, then you should use regular
RibbonMenuItems:This is how it should be done, when menu items are statically known:
When using
ItemsSourcefor menu items, XAML will look like this:where
MenuItemsis a collection of these view models: