Share via


UWP: How to Bind TextBlock to TextBox

Step 1: Drag content on grid

-Drag a Button,TextBox and TextBlock from Toolbox on your grid in MainPage.xaml

https://1.bp.blogspot.com/-jcE1QbDnbXs/Vlg_sPaZyiI/AAAAAAAAAMM/TqeciMj2sAE/s1600/1.PNG

Step 2: edit Button

-Double click on Button in MainPage.xaml,this will open MainPage.xaml.cs

https://3.bp.blogspot.com/-ERjwtip_EZk/VlhBKkXvtKI/AAAAAAAAAMw/MljowKkUD5w/s1600/5%252C3.PNG

Step 3: Add code

Type this given code in MainPage.xaml.cs

https://2.bp.blogspot.com/-972y92p2PVA/VlhBKk9GfmI/AAAAAAAAANE/z4ti5iGzQ_Q/s1600/4%252C2.PNG

Step 4:Save

-Save All files(control+shift+S) And Run in Local Machine

https://1.bp.blogspot.com/-xUMyWu1a1gM/VlhCVstf4rI/AAAAAAAAANI/ErzrbUFfZ6E/s1600/5%252C4.PNG

Step 5: Add text

Now Type any text in textBox and press Button

https://4.bp.blogspot.com/-R3xSpBuNvPs/Vlg_sEHyNlI/AAAAAAAAAMc/-rJ8poRBpmI/s1600/2.PNG

Step 6: Result

This will give you result in TextBlock

https://1.bp.blogspot.com/-zqtzD6ss7ZI/Vlg_r5Pm35I/AAAAAAAAAMU/3fidc5XcP6M/s1600/3.PNG