I'm trying to use a DropDownButton from the Fluent ribbon control in a WPF application using Caliburn.Micro.
So far, everything is good. I see a list of my Unicorns as GalleryItems in the DropDownButton. The only problem is that I could not get the "ShowUnicorn()" working. When I click on an item from the DropDownButton's list it does nothing. Am I doing something wrong?
This is the code that I use:
<Fluent:DropDownButton Header="Farm"
LargeIcon="..\..\Resources\unicorn48.png">
<Fluent:Gallery ItemsSource="{Binding AllUnicorns}">
<Fluent:Gallery.ItemTemplate>
<DataTemplate>
<Fluent:GalleryItem Content="{Binding UnicornFoobar}"
cal:Message.Attach="[Event Click] = [Action ShowUnicorn()]" />
</DataTemplate>
</Fluent:Gallery.ItemTemplate>
</Fluent:Gallery>
Thanks in advance.
cal:Action.TargetWithoutContext
to the ViewModel. Basically what's happening is that theDataContext
for each row is the actual data item itself (not the VM) and when you click, CM is trying to resolve the method against the data item. You need to tell CM that you want to target the VM with the action and not the data row in the gallery. – Brachy