Aracılığıyla paylaş


Nasıl Yapılır: Bağımlı Hedef Özelliğinden Bağlama Nesnesi Alma

This example shows how to obtain the binding object from a data-bound target property.

Örnek

You can do the following to get the Binding object:

// textBox3 is an instance of a TextBox
// the TextProperty is the data-bound dependency property
Binding myBinding = BindingOperations.GetBinding(textBox3, TextBox.TextProperty);
NotNot

You must specify the dependency property for the binding you want because it is possible that more than one property of the target object is using data binding.

Alternatively, you can get the BindingExpression and then get the value of the ParentBinding property.

Tam örnek için bkz: Bağlama doğrulaması örnek.

NotNot

If your binding is a MultiBinding, use BindingOperations.GetMultiBinding.If it is a PriorityBinding, use BindingOperations.GetPriorityBinding.If you are uncertain whether the target property is bound using a Binding, a MultiBinding, or a PriorityBinding, you can use BindingOperations.GetBindingBase.

Ayrıca bkz.

Görevler

Nasıl Yapılır: Kod İçinde Bağlama Oluşturma

Diğer Kaynaklar

Veri Bağlama Nasıl Yapılır Konuları