Multibinding as resource in XAML

2020-02-29 02:04发布

Is it possible (if yes how), to add multivaluebinding expression into resource.

I have a Multivalue binding, that takes 2 separate binding, and converter parameter in one of those binding.

I have to use this binding to 5 Different items, and those binding tags differ only in converter parameter. Rest everything is same.

I would to avoid repetition of multibinding boilerplate tags.

1条回答
beautiful°
2楼-- · 2020-02-29 02:38

Easy way of seeing if something works: TRY IT!

    <Style TargetType="Button">
        <Setter Property="Content">
            <Setter.Value>
                <MultiBinding Converter="{StaticResource OmgLolzConverter}">
                    <Binding Path="One" Converter="{StaticResource CakeConverter}"/>
                    <Binding Path="Two" Converter="{StaticResource CakeConverter}"/>
                </MultiBinding>
            </Setter.Value>
        </Setter>
    </Style>

Works fine.

查看更多
登录 后发表回答