【发布时间】:2016-11-17 07:28:02
【问题描述】:
我在附加文件时尝试添加描述,并且我使用 MVVM 模型。我创建了一个 commandHolder 并从那里创建了一个命令,但我无法将 Lazy<View> 转换为 Lazy<RelayCommand> 我请求您帮助我。
this.fileAttachmentDescriptionCommandHolder = new Lazy<FileAttachmentDescriptionView>(() => new FileAttachmentDescriptionView { DataContext = this });
this.fileAttachmentDescriptionViewHolder = new Lazy<RelayCommand>(this.CreateFileAttachmentDescriptionCommand);
我得到错误:
错误 CS0029 无法隐式转换类型 'System.Lazy Path.RelayCommand' 到 'System.Lazy path.View'
【问题讨论】:
-
似乎您将视图分配给“commandHolder”并将命令分配给“viewHolder”。这没有多大意义。
-
感谢机械师和凯文
-
@SanthoshRajoo 如果确实回答了您的问题,请点击投票按钮下方的复选标记,随时将答案标记为“答案”。