多重绑定作为 XAML 中的资源 [英] Multibinding as resource in XAML

查看:25
本文介绍了多重绑定作为 XAML 中的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以(如果是的话)添加multivaluebinding 表达式到资源中.

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

我有一个多值绑定,它需要 2 个单独的绑定,以及其中一个绑定中的转换器参数.

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

我必须将此绑定用于 5 个不同的项目,这些绑定标签仅在转换器参数上有所不同.休息一切都一样.

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>

工作正常.

这篇关于多重绑定作为 XAML 中的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆