来自另一个类的绑定值

时间:2018-01-26 09:29:47

标签: c# wpf mvvm

我有帮助类,在此

UserModel _CurrentUser = new UserModel();
public UserModel CurrentUser
{
    get
    {
        return _CurrentUser;
    }
    set
    {
        if(Equals(value,_CurrentUser))
        {
            return;
        }
        _CurrentUser = value;
        RaisePropertyChanged("CurrentUser");
        UserDataAccessor.UpdateUserLoginTime(_CurrentUser);
    }
}

在MainWindow.xaml

xmlns:helper="clr-namespace:TMSV2.Helper"

我想在Name的{​​{1}}中显示CurrentUser的{​​{1}}属性。

TextBlock

如何在mainwidow中显示此值?

更新

我的用户模型是

<TextBlock Grid.Row="0" Grid.Column="2" Margin="0,40,30,40"
           Text="How can i write here"/>

0 个答案:

没有答案
相关问题