WPF Ribbon Fluent: DropDownButton + Caliburn.Micro Event

I am trying to use DropDownButton from a Fluent control in a WPF application using Caliburn.Micro.

So far so good. I see a list of my unicorns as GalleryItems in DropDownButton. The only problem is that I could not get "ShowUnicorn ()" to work. When I click on an item from the DropDownButton list, it does nothing. Am I doing something wrong?

This is the code I'm using:

<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.

0
source share
1 answer

Thanks @Charleh for the hint (I really didn't know about it) I found a good answer here: fooobar.com/questions/954494 / ...

I also changed Fluent: GalleryItem with a button:

 <Fluent:DropDownButton x:Name="aaaa" Header="Farm" LargeIcon="..\..\Resources\unicorn48.png"> <Fluent:Gallery ItemsSource="{Binding AllUnicorns}"> <Fluent:Gallery.ItemTemplate> <DataTemplate> <Button Content="{Binding UnicornFoobar}" cal:Message.Attach="[Event Click] = [Action ShowUnicorn($dataContext)]" cal:Action.TargetWithoutContext="{Binding DataContext, ElementName=aaaa}" /> </DataTemplate> </Fluent:Gallery.ItemTemplate> </Fluent:Gallery> 
+2
source

Source: https://habr.com/ru/post/954495/


All Articles