gpt4 book ai didi

wpf - 在 TextBlock 中使用绑定(bind)硬编码文本

转载 作者:行者123 更新时间:2023-12-03 06:01:04 26 4
gpt4 key购买 nike

在 WPF 中,有没有办法让 TextBlockText 属性包含硬编码文本和特定绑定(bind)?

我想到的是以下内容(当然,下面的内容无法编译):

<TextBlock Text="Number of Fans: {Binding Artist.Fans.Count}"></TextBlock>

最佳答案

如果您使用的是 .Net 3.5 SP1,则有

<TextBlock Text="{Binding Path=Artist.Fans.Count, 
StringFormat='Number of Fans: {0}'}" />

关于wpf - 在 TextBlock 中使用绑定(bind)硬编码文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/789222/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com