2016-07-14 10 views
-4

ファイルを添付するときに説明を追加しようとしていますが、MVVMモデルを使用しています。私はcommandHolderを作成し、そこからコマンドを作成して、Lazy<View>Lazy<RelayCommand>に変換することができません。Lazy <View>をLazy <RelayCommand>に変換して戻す

this.fileAttachmentDescriptionCommandHolder = new Lazy<FileAttachmentDescriptionView>(() => new FileAttachmentDescriptionView { DataContext = this }); 

this.fileAttachmentDescriptionViewHolder = new Lazy<RelayCommand>(this.CreateFileAttachmentDescriptionCommand); 

私はエラーを取得する:

Error CS0029 Cannot implicitly convert type 'System.Lazy Path.RelayCommand' to 'System.Lazy path.View'

+0

「commandHolder」にビューを割り当て、「viewHolder」にコマンドを割り当てたようです。これはあまり意味がありません。 – mechanic

+0

Thanks mechanic and Kevin –

+0

@SanthoshRajooは本当にあなたの質問に答えたら、投票ボタンの下にあるチェックマークをクリックすることで、回答を「回答」としてマークすることができます。 – Kcvin

答えて

1

私はメカニックによるコメントで述べたように、あなたが、後方にそれをやっていると思います。

this.fileAttachmentDescriptionCommandHolder = 
    new Lazy<RelayCommand>(this.CreateFileAttachmentDescriptionCommand); 

this.fileAttachmentDescriptionViewHolder = 
    new Lazy<FileAttachmentDescriptionView>(
     () => new FileAttachmentDescriptionView { DataContext = this });