Multibinding as resource in XAML
Asked Answered
A

1

6

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.

Arrowworm answered 5/2, 2013 at 6:22 Comment(1)
All you need is a possibility to create xaml-functions. We'd love to have them, but they don't exist. If you apply MVVM pattern, you'll be able to replace a multibinding with an additional property, that reflects some additional logic.Fractionate
A
6

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.

Arsenate answered 20/2, 2013 at 1:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.