c# - 将TextBlock的文本设置为字符串加绑定(bind)项?

标签 c# listview binding

我有一个 ListView,里面有多个 TextBlock。有可能有这样的东西吗?

TextBlock x:Name="AuthorInfo" Text="Author: {Binding data.author}"

还是在设置时将其添加到 data.author 会更好?

最佳答案

如果是 XAML,您可以使用 StringFormat

<TextBox Text="{Binding Path=data.author, StringFormat=Author: {0}}"/>

关于c# - 将TextBlock的文本设置为字符串加绑定(bind)项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13214194/

相关文章:

c# - `The property Hashtags is valid only for Exchange Exchange2015 or later versions.' 当 `EmailMessage.Bind` 时

listview - 如何通过 ListView 进行过滤

wpf - 绑定(bind)到 WPF 中 TabControl 的 ItemsSource

c# - Xamarin 中的弹出窗口太长

c# - 检测简单的触摸手势

c - 为什么我的所有者数据 ListView 状态图像在 Windows XP 上显示为空白?

java - 如何创建看起来 TextView 比它大的列表项?

c# - 在我的项目 Xamarin 中实现 INotifyPropertyChanged

javascript - 无法重新启动逻辑井字游戏 (JavaScript)

c# - 如何在 WebMethod 中获取调用方的 IP 地址?