2

私はWPF DataGrid

私が持っているプロパティを持つ(編集されたセル)bindのテキストが欲しいCurrentCellViewModel

これを行うことは可能ですか?

編集:

私はこの方法を試します:

 <DataGrid CurrentCell="{Binding MyProp}"...../>

私はこのエラーを受け取ります:

Value produced by BindingExpression is not valid for target property.; Value='<null>' BindingExpression:Path=MyProp; DataItem='MyViewModel' (HashCode=38365672); target element is 'DataGrid' (Name='CustomCmdDg'); target property is 'CurrentCell' (type 'DataGridCellInfo')
4

2 に答える 2

0

私はあなたの問題を正しく理解しているかどうかわかりません。しかし、ラベルを使用してDataTemplateを作成し、そのコンテンツプロパティをviewmodelプロパティにバインドすることを検討しましたか?

于 2013-02-17T12:12:10.140 に答える
0

OK、それはこのように成功しました:

<DataGrid CurrentCell="{Binding MyProp, Mode=OneWayToSource}"...../>
于 2013-02-18T06:24:32.910 に答える