BindingBase.TargetNullValue プロパティ
定義
ソースの値が null
のときにターゲットで使用される値を取得または設定します。Gets or sets the value that is used in the target when the value of the source is null
.
public:
property System::Object ^ TargetNullValue { System::Object ^ get(); void set(System::Object ^ value); };
public object TargetNullValue { get; set; }
member this.TargetNullValue : obj with get, set
Public Property TargetNullValue As Object
プロパティ値
ソースの値が null
のときにターゲットで使用される値。The value that is used in the target when the value of the source is null
.
例
次の例では、を TextBox オブジェクトのプロパティにバインドしています。The following example binds a TextBox to a property of an object. プロパティがの場合は、 null
TextBox "文字列を入力してください。" と表示されます。If the property is null
, the TextBox displays "please enter a string."
<TextBox Width="150"
Text="{Binding Source={StaticResource object2},
Path=PropertyB, BindingGroupName=bindingGroup,
TargetNullValue=please enter a string}" />
注釈
XAML テキストの使用XAML Text Usage
<object TargetNullValue="nullValue" />
もしくは- or -
<object>
<object.TargetNullValue>
nullValue
</object.TargetNullValue>
</object>
XAML 値XAML Values
nullValuenullValue
ターゲットプロパティと同じ型の属性またはオブジェクト要素の値。An attribute or object element value of the same type as the target property. XAML の使用情報については、その型のドキュメントを参照してください。See that type's documentation for XAML usage information. その型は、その値の属性構文をサポートしているか、またはサポートしていないか、またはオブジェクト要素構文 (その型のパラメーターなしのコンストラクターを必要とする) をサポートしていない可能性があります。That type may or may not support attribute syntax for its values, or may or may not support object element syntax (which requires a parameterless constructor on that type).