<Window x:Class="TextDataBinding.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="TextDataBinding" Height="300" Width="300">
<Grid>
<TextBlock>
Name:
<TextBlock Text="{Binding FirstName}" />
<TextBlock Text="{Binding LastName}" />
</TextBlock>
</Grid>
</Window>
//File:Window.xaml.vb
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes
Namespace TextDataBinding
Public Partial Class Window1
Inherits System.Windows.Window
Private src As New Person()
Public Sub New()
InitializeComponent()
src.FirstName = "A"
src.LastName = "B"
Me.DataContext = src
End Sub
End Class
Public Class Person
Private firstNameValue As String
Public Property FirstName() As String
Get
Return firstNameValue
End Get
Set
firstNameValue = value
End Set
End Property
Private lastNameValue As String
Public Property LastName() As String
Get
Return lastNameValue
End Get
Set
lastNameValue = value
End Set
End Property
End Class
End Namespace