Intersoft ClientUI 8 > ClientUI Fundamentals > Data Binding Overview > Data Binding Walkthroughs > Walkthrough: Bind to Parent Property in XAML using FindName |
This walkthrough shows how to bind the Value property of UXProgressBar to the Text property of UXTextBox. The binding is perform using FindName mode of ClientUI Binding Framework.
In this walkthrough, you perform the following tasks:
You need the following components to complete this walkthrough:
The first step is to create a new ClientUI Application project using Intersoft ClientUI Application project template in Visual Studio.
This section shows how to create UXTexBox and UXProgressBar that will be used in the binding scenario.
XAML |
Copy Code
|
---|---|
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Width="200"> </StackPanel> |
XAML |
Copy Code
|
---|---|
<Grid x:Name="LayoutRoot"> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Width="200"> <Intersoft:UXTextBox Name="uXTextBox1" Text="10" Margin="0,0,0,10" /> </StackPanel> </Grid> |
XAML |
Copy Code
|
---|---|
<Grid x:Name="LayoutRoot"> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Width="200"> <Intersoft:UXTextBox Name="uXTextBox1" Text="10" Margin="0,0,0,10" /> <Intersoft:UXProgressBar Height="20" Maximum="100" /> </StackPanel> </Grid> |
This section shows how to bind the Value property of UXProgressBar to the Text property of UXTextBox using FindName mode.
XAML |
Copy Code
|
---|---|
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Width="200"> <Intersoft:UXTextBox Name="uXTextBox1" Text="10" Margin="0,0,0,10" /> <Intersoft:UXProgressBar Height="20" Name="uXProgressBar1"> <Intersoft:BindingFramework.Binding> <Intersoft:BindingDescriptor TargetProperty="Value" SourceProperty="Text" Mode="FindName" ElementName="uXTextBox1"/> </Intersoft:BindingFramework.Binding> </Intersoft:UXProgressBar> </StackPanel> |
For more information about ClientUI Binding Framework, see Data Binding Overview.
This section lists the complete code used in this walkthrough.
XAML |
Copy Code
|
---|---|
<Intersoft:UXPage xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:Intersoft="http://intersoft.clientui.com/schemas" x:Class="ClientUIApplication1.MainPage" Title="MainPage Page" d:DesignWidth="640" d:DesignHeight="480"> <Grid x:Name="LayoutRoot"> <StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Width="200"> <Intersoft:UXTextBox Name="uXTextBox1" Text="10" Margin="0,0,0,10" /> <Intersoft:UXProgressBar Height="20" Name="uXProgressBar1"> <Intersoft:BindingFramework.Binding> <Intersoft:BindingDescriptor TargetProperty="Value" SourceProperty="Text" Mode="FindName" ElementName="uXTextBox1"/> </Intersoft:BindingFramework.Binding> </Intersoft:UXProgressBar> </StackPanel> </Grid> </Intersoft:UXPage> |