我可以在IValueConverter中使用模型类吗?

时间:2020-01-14 16:36:55

标签: c# mvvm

例如:

using Person; // <-- resides inside Model layer!!!! is *that* allowed???

public class PersonNameConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return ((Person)value).Name;
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotImplementedException();
    }
}

我想知道这里是否没有违反任何MVVM规则。

0 个答案:

没有答案