Intersoft ClientUI Documentation
BindingDescriptor Class
Members 



Describes the members for binding operation in BindingFramework.
Syntax
Public Class BindingDescriptor 
Dim instance As BindingDescriptor
public class BindingDescriptor 
public ref class BindingDescriptor 
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
Copy Code
<Intersoft:UXListBox ItemsSource="{Binding Collection}" ImageMemberPath="Image" ItemContentType="ContentAndImage" 
                        ItemImageHeight="32" ItemImageWidth="32" HorizontalScrollBarVisibility="Disabled">
    <Intersoft:UXListBox.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <TextBlock Text="{Binding Name}"/>
                <StackPanel Orientation="Horizontal">
                    <Intersoft:BindingFramework.Binding>
                        <Intersoft:BindingDescriptor TargetProperty="Visibility" SourceProperty="IsSelected"
                                                                    Mode="FindAncestor" AncestorType="UXListBoxItem"
                                                                    Converter="{StaticResource VisibilityConverter}"/>
                    </Intersoft:BindingFramework.Binding>
                    <Intersoft:UXHyperlinkButton Content="Details" IsToggleButton="False" Foreground="Navy"/>
                    <Intersoft:UXHyperlinkButton Content="Order" IsToggleButton="False" Foreground="Navy" Margin="8,0,0,0"/>
                </StackPanel>
            </StackPanel>
        </DataTemplate>
    </Intersoft:UXListBox.ItemTemplate>
</Intersoft:UXListBox>
C#
Copy Code
public class VisibilityConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is bool && targetType == typeof(Visibility))
        {
            if ((bool)value)
                return Visibility.Visible;
            else
                return Visibility.Collapsed;
        }

        return value;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        if (value is Visibility && targetType == typeof(bool))
        {
            if (((Visibility)value) == Visibility.Visible)
                return true;
            else
                return false;
        }

        return value;
    }
}

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
Copy Code
<Grid Height="400" Width="550" x:Name="MainContainer" >

    <Intersoft:UXProgressBar Height="20" Maximum="700">
        <Intersoft:BindingFramework.Binding>
            <Intersoft:BindingDescriptor TargetProperty="Value" SourceProperty="Width"
                                            Mode="FindName" ElementName="MainContainer"/>
        </Intersoft:BindingFramework.Binding>
    </Intersoft:UXProgressBar>

</Grid>

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
Copy Code
<Intersoft:UXTextBox BorderThickness="4" Text="#FFFF0000" HorizontalAlignment="Center" VerticalAlignment="Center">
    <Intersoft:BindingFramework.Binding>
        <Intersoft:BindingDescriptor TargetProperty="BorderBrush" SourceProperty="Text" Mode="Self" Converter="{StaticResource ColorConverter}" />
    </Intersoft:BindingFramework.Binding>
</Intersoft:UXTextBox>
Inheritance Hierarchy

System.Object
   Intersoft.Client.Framework.BindingDescriptor

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

BindingDescriptor Members
Intersoft.Client.Framework Namespace

Concepts

Data Binding Overview

Send Feedback