ChungusKhan
ChungusKhan

Reputation: 35

Avalonia - using the in-built Avalonia.Data.Converters

I am trying to use the BoolConverters.And converter, but cannot seem to find a way to get it working inside XAML.

Xmlns declaration:

xmlns:acon="clr-namespace:Avalonia.Data.Converters.BoolConverters;assembly=Avalonia.Base"

Resources:

<UserControl.Resources>
    <ResourceDictionary>
        <acon:And x:Key="andConverter"/>
    </ResourceDictionary>
</UserControl.Resources>

The binding: (I hope I got the multi-value syntax right)

<StackPanel.IsVisible>
    <MultiBinding Converter="{DynamicResource andConverter}">
        <MultiBinding.Bindings>
            <Binding Path="Foo"/>
            <Binding Path="Bar"/>
        </MultiBinding.Bindings>
    </MultiBinding>
</StackPanel.IsVisible>

What am I missing here?

Upvotes: 3

Views: 5554

Answers (1)

kekekeks
kekekeks

Reputation: 3623

Converter="{x:Static BoolConverters.And}". see https://github.com/AvaloniaUI/Avalonia/blob/cc714a203c3a16310bd4104a38f8a525588f65a2/src/Avalonia.Themes.Default/TextBox.xaml#L25 for usage example.

Upvotes: 7

Related Questions