Reputation: 38455
Well i have this code in my code behind
Public Shared ReadOnly UsernameProperty As DependencyProperty = DependencyProperty.Register("Username", GetType(String), GetType(LoginControl), Nothing)
Public Property Username() As String
Get
Return CStr(MyBase.GetValue(UsernameProperty))
End Get
Set(ByVal value As String)
MyBase.SetValue(UsernameProperty, value)
End Set
End Property
and then i have this in xaml on the same page
<TextBlock Text="{Binding Path=Username}" Style="{StaticResource WelcomeTextStyle}"/>
but the textblock does not seem to update its value..
Upvotes: 1
Views: 135
Reputation: 3343
You set the path to "Username", but the Binding needs to know what object to look for that property on. One way to do this is, set the DataContext to the LoginControl.
Upvotes: 1