Update textbox changes over label using WPF

Pardhu2020
Posted by in WPF category on for Beginner level | Points: 250 | Views : 7771 red flag

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.


  1. Once open the Visual Studio click on File Click on the Project .

  1. As you are seeing there are many applications from them Select WPF application .
  2. At name rename it as per your requirement.

  1. Right click on the project and click on add from there click on window for adding a new window to the project
  2. Rename the window as per your requirement.

  1. Drag a text box from tools .
  2. Drag a TextBlock from the tools and rename it has Value..
  3. 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.



Page copy protected against web site content infringement by Copyscape

About the Author

Pardhu2020
Full Name: Pardha Saradhi
Member Level:
Member Status: Member
Member Since: 3/19/2013 2:21:22 PM
Country: India

http://www.dotnetfunda.com

Login to vote for this post.

Comments or Responses

Login to post response

Comment using Facebook(Author doesn't get notification)