Skip to end of metadata
Go to start of metadata

Remarks

BindingDescriptor is one of many functionality provided in ClientUI Advanced Binding Framework. To learn more about this see Data Binding Overview.

BindingDescriptor has three modes of binding that you can choose from, they are FindAncestor, FindName and Self. Each of this mode has different purpose and different settings.

FindAncestor

FindAncestor is used to bind the target with a specific ancestor element type defined in specific ancestor level range. This mode is commonly used when you know that a specific ancestor element type existed on certain level.

In this mode, you specify the AncestorType to determine the type of the target that will be bound and the AncestorLevel to determine how far it will look up for the ancestor with types specifed in AncestorType.

The default value of AncestorLevel is 1, so it will look at up one time and check whether the current ancestor match the type specified in AncestorType. If it matches, it will continue with the binding process.

The following example shows how to use FindAncestor mode to bind the elements inside ItemTemplate of a UXListBox to UXListBoxItem as their ancestor.

XAML
C#

This sample bind the Visibility property of StackPanel to the IsSelected property of UXListBoxItem using FindAncestor. Notice that the BindingDescriptor also supports IValueConverter.

FindName

FindName is used to bind the target with an element with specific name. In this mode, you specify the ElementName that the target will be bound to.

The following example shows how to use FindName mode to bind the target with an element with the specific name specified in ElementName property.

XAML

This sample bind the Value property of UXProgressBar to MainContainer Width property using FindName.

Self

Self is used to bind the target within itself. You can bind one property with other property within the same element using this mode without needing to specify element name each time.

The following example shows how to use Self mode to bind Text property of UXTextBox to its BorderBrush.

XAML

Definition

public class BindingDescriptor

Summary

The following table summarizes the members exposed in this class.

Public Constructors

BindingDescriptor Constructor()Creates a new instance of BindingDescriptor class.

Public Properties

AncestorLevelGets or sets the level of ancestor to look for, in FindAncestor mode. Use 1 to indicate the one nearest to the binding target element.
AncestorTypeGets or sets the type of ancestor to look for.
ConverterGets or sets the converter to use.
ConverterParameterGets or sets the parameter to pass to the Converter.
DetectPopupGets or sets a value that indicates whether binding descriptor will try to detect parent popup.
ElementNameGets or sets the element name for the target data binding.
MatchBaseTypeGets or sets a value that indicates whether binding descriptor will try to match base type.
ModeGets or sets a BindingSourceMode value that describes the location of the binding source relative to the position of the binding target.
SourcePropertyGets or sets the source property for data binding.
TargetPropertyGets or sets the target property for data binding.

Public Constructors

public BindingDescriptor()

Creates a new instance of BindingDescriptor class.

Public Properties

public int AncestorLevel { get; set; }

Gets or sets the level of ancestor to look for, in FindAncestor mode. Use 1 to indicate the one nearest to the binding target element.

public string AncestorType { get; set; }

Gets or sets the type of ancestor to look for.

public IValueConverter Converter { get; set; }

Gets or sets the converter to use.

public object ConverterParameter { get; set; }

Gets or sets the parameter to pass to the Converter.

public bool DetectPopup { get; set; }

Gets or sets a value that indicates whether binding descriptor will try to detect parent popup.

public string ElementName { get; set; }

Gets or sets the element name for the target data binding.

Remarks

BindingSourceMode is used to bind the target with an element with specific name. In this mode, you specify the ElementName that the target will be bound to.

 

public bool MatchBaseType { get; set; }

Gets or sets a value that indicates whether binding descriptor will try to match base type.

public BindingSourceMode Mode { get; set; }

Gets or sets a BindingSourceMode value that describes the location of the binding source relative to the position of the binding target.

public string SourceProperty { get; set; }

Gets or sets the source property for data binding.

public string TargetProperty { get; set; }

Gets or sets the target property for data binding.

  • No labels