views:

35

answers:

1

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..

+1  A: 

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.

KeithMahoney