Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net Silverlight数据绑定_Vb.net_Silverlight_Data Binding - Fatal编程技术网

Vb.net Silverlight数据绑定

Vb.net Silverlight数据绑定,vb.net,silverlight,data-binding,Vb.net,Silverlight,Data Binding,我的代码里有这个代码 Public Shared ReadOnly UsernameProperty As DependencyProperty = DependencyProperty.Register("Username", GetType(String), GetType(LoginControl), Nothing) Public Property Username() As String Get Return CStr(MyBase.

我的代码里有这个代码

 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
然后我在同一页的xaml中有这个

<TextBlock Text="{Binding Path=Username}" Style="{StaticResource WelcomeTextStyle}"/>

但是textblock似乎没有更新其值。

您将路径设置为“Username”,但是绑定需要知道在哪个对象上查找该属性。 一种方法是,将DataContext设置为LoginControl。

将路径设置为“Username”,但绑定需要知道在哪个对象上查找该属性。 一种方法是将DataContext设置为LoginControl