Pergunta

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.

Foi útil?

Solução

Thanks @Charleh for the hint (I really had no clue about it) I found a good answer here: https://stackoverflow.com/a/18980558/187650

Also I changed the 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>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top