简体   繁体   中英

Multibinding as resource in XAML

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM