Skip to content
Discussion options

You must be logged in to vote

There are at least 3 ways you could do what you want to do in the view.

Using the enum to bool converter or your own custom converter as you mentioned or using a DataTemplate.

EnumToBoolCoverter

Only documented in where it is used as part of the colour picker controls

<UserControl
    <!-- Rest ommited for brevity -->
    xmlns:converters="using:Avalonia.Controls.Converters">

    <UserControl.Resources>
        <converters:EnumToBoolConverter x:Key="enumConverter" />
    </UserControl.Resources>

    <!-- Show the football image if it is selected -->
    <Icon IsVisible="{Binding Type, Converter={StaticResource enumConverter}, ConverterParameter={x:Static ClubEnum:Club.Football}}"/>

</U…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@tobyfirth
Comment options

@Molenfeuer
Comment options

@maxkatz6
Comment options

@Molenfeuer
Comment options

@Molenfeuer
Comment options

Answer selected by Molenfeuer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants