Articles → WPF → Binding Property Of One Element To Other In WPF

Binding Property Of One Element To Other In WPF











<Grid>
	<Grid.ColumnDefinitions>
		<ColumnDefinition></ColumnDefinition>
		<ColumnDefinition></ColumnDefinition>
	</Grid.ColumnDefinitions>
	<Button Content="Test" Background="Red" x:Name="Button1"></Button>
	<TextBox Name="TextBox1" Grid.Column="1"></TextBox>
</Grid>




  Property_Name = "{Binding ElementName=Control_Name, Path=Control_Property}"




    <TextBox Name="TextBox1" Grid.Column="1" Text="{Binding ElementName=Button1, Path=Content}"/>




Picture showing the output of binding property of one element to other in WPF
Click to Enlarge



<TextBox Name="TextBox1" Grid.Column="1">
	<TextBox.Text>
		<Binding ElementName="Button1" Path="Content"></Binding>
	</TextBox.Text>
</TextBox>





Posted By  -  Karan Gupta
 
Posted On  -  Thursday, December 23, 2010

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250