BindingBase.StringFormat 属性

定义

获取或设置此绑定的字符串格式。

public string StringFormat { get; set; }
member this.StringFormat : string with get, set

属性值

指定此绑定值的格式的字符串。

注解

用于为绑定值提供显示格式,或将值与其他文本组合在一起。 的 BindingBase 实现者决定字符串格式的利用方式,但所有实现者都支持标准 Format 约定。

Binding 允许为其单数值使用一个参数。

一个简单的示例,演示如何使用 组合文本并确定值的显示格式 Binding

Label label = new Label();
label.AddBinding (new Binding (Label.TextProperty, "Price") {
  StringFormat = "Price: {0:C2}"
});

适用于

另请参阅