【问题标题】:Label Multibinding With Static使用静态标签多重绑定
【发布时间】:2021-07-06 22:02:05
【问题描述】:

如何在MultiBinding Label 中显示x:Static 变量?

<Label>
    <Label.Text>
        <MultiBinding StringFormat="{}{0} {1}">
            <Binding Path="x:Static resources:AppResources.FirstName"/>
            <Binding Path="User.FirstName"/>
        </MultiBinding>
    </Label.Text>
</Label>

想要的结果:

名字:约翰

【问题讨论】:

标签: c# xamarin xamarin.forms


【解决方案1】:

使用Source,而不是Path

<Label>
    <Label.Text>
        <MultiBinding StringFormat="{}{0} {1}">
            <Binding Source="{x:Static resources:AppResources.FirstName}"/>
            <Binding Path="User.FirstName"/>
        </MultiBinding>
    </Label.Text>
</Label>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-09
    • 2012-02-04
    • 1970-01-01
    • 1970-01-01
    • 2011-05-22
    • 2017-05-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多