-->

Friday, August 22, 2014

How to bind Text property of Text block to the text property of a text box in windows phone

How to bind Text property of Text block to the text property of a text box in windows phone

Its a very simple method to bind Text Block from the Text Box in the windows phone. You can use Property="{Binding <source property>, ElementName=<Source Name>}" this method. Lets take an simple example
1. Add one Text Block and One Text Box control on windows phone phone.

Xaml code


 <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <TextBlock Text="{Binding text,ElementName=txtbox1}" x:Name="txtblock" HorizontalAlignment="Left" Margin="63,74,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="210"/>

            <TextBox x:Name="txtbox1" HorizontalAlignment="Left" Height="72" Margin="33,139,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="335" AcceptsReturn="True"/>

        </Grid>

Code generate the following output

How to bind Text property of Text block to the text property of a text box in windows phone


Read other related articles

Also read other articles

© Copyright 2013 Computer Programming | All Right Reserved