In this article we will discuss how the text box changes will update Label using WPF
Introduction
Hi friends today we will discuss how the textbox changes will update Label using WPF.
- Once open the Visual Studio click on File Click on the Project .
- As you are seeing there are many applications from them Select WPF application .
- At name rename it as per your requirement.
- Right click on the project and click on add from there click on window for adding a new window to the project
- Rename the window as per your requirement.
- Drag a text box from tools .
- Drag a TextBlock from the tools and rename it has Value..
- Based on the below code will update the textbox change on textblock .
<Window x:Class="DataBindingExamples.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<StackPanel Margin="10">
<TextBox Name="txtValue"/>
<WrapPanel Margin="0,10">
<TextBlock Text="Value: " FontWeight="Bold"/>
<TextBlock Text="{Binding Path=Text, ElementName=txtValue}"/>
</WrapPanel>
</StackPanel>
</Window>
Output :
Conclusion :
In this article we have seen how to update the textbox changes over Label Using WPF.