首页 > 解决方案 > 我们可以有一个包含默认值 + 绑定数据的内容吗?

问题描述

我想知道 WPF 中是否有可能执行以下操作:

<Label Content="ValueWhoNeverChange + {Binding MyTargetValue}"/>

标签: c#wpfbinding

解决方案


您可以使用ContentStringFormat属性,例如

<Label Content="{Binding Path=MyTargetValue}"
    ContentStringFormat="ValueWhoNeverChange {0}" />

我希望它可以帮助你。


推荐阅读