Aracılığıyla paylaş


TemplateBinding Biçimlendirme Uzantısı

Şablonu esas alan denetimi özelliğinin değeri olması için bir denetim şablonu özelliğinin değeri bağlar.

XAML Attribute Usage

<object property="{TemplateBinding targetProperty}" .../>

XAML Attribute Usage (for Setter property in template or style)

<Setter Property="propertyName" Value="{TemplateBinding targetProperty}" .../>

XAML Values

propertyName

DependencyProperty.Name of the property being set in the setter syntax.

targetProperty

A dependency property that exists on the type being templated, specified by its DependencyProperty.Name.

- or -

A "dotted-down" property name that is defined by a different type than the target type being templated. This is actually a PropertyPath. See PropertyPath XAML sözdizimi.

Açıklamalar

A TemplateBinding is an optimized form of a Binding for template scenarios, analogous to a Binding constructed with {Binding RelativeSource={RelativeSource TemplatedParent}}.

RelativeSource is another markup extension that is sometimes used in conjunction with or instead of TemplateBinding in order to perform relative property binding within a template.

Describing control templates as a concept is not covered here; for more information, see Denetim stillerine ve şablonlar.

Attribute syntax is the most common syntax used with this markup extension. The string token provided after the TemplateBinding identifier string is assigned as the Property value of the underlying TemplateBindingExtension extension class.

Nesne öğesi sözdizimi mümkündür, ancak gerçekçi bir uygulama olduğu için onu gösterilmez. TemplateBinding is used to fill values within setters, using evaluated expressions, and using object element syntax for TemplateBinding to fill <Setter.Property> property element syntax is unnecessarily verbose.

TemplateBinding can also be used in a verbose attribute usage that specifies the Property property as a property=value pair:

<object property="{TemplateBinding Property=targetProperty}" .../>

The verbose usage is often useful for extensions that have more than one settable property, or if some properties are optional. Because TemplateBinding has only one settable property, which is required, this verbose usage is not typical.

De WPF xaml işlemci uygulaması, bu biçimlendirme uzantı işleme göre tanımlanır TemplateBindingExtension sınıfa

TemplateBinding is a markup extension. Markup extensions are typically implemented when there is a requirement to escape attribute values to be other than literal values or handler names, and the requirement is more global than just putting type converters on certain types or properties. xaml kullanımda tüm biçimlendirme uzantıları { ve } kendi öznitelik sözdizimi kuralı xaml işlemci tanıdığı olduğunu işaretleme uzantısı gerekir işlem sıralamada olduğu karakterlerözniteliği. For more information, see Biçimlendirme Uzantıları ve WPF XAML.

Ayrıca bkz.

Başvuru

RelativeSource MarkupExtension

Biçimlendirme Uzantısı Bağlama

Style

ControlTemplate

Kavramlar

Stillendirme ve Şablon Oluşturma

XAML'e Genel Bakış (WPF)

Biçimlendirme Uzantıları ve WPF XAML