ItemsControl内のボタンにmyコマンドをバインドするときにエラーが発生しました。Silverlightによる相対バインディングコマンドWP7
<phone:PhoneApplicationPage.DataContext>
<ViewModel:MyViewModel />
</phone:PhoneApplicationPage.DataContext>
と::
これは私のコードである
<ItemsControl ItemsSource="{Binding MyList}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="Test"
cmd:ButtonBaseExtensions.Command="{Binding MyViewModel.TestCommand}"
cmd:ButtonBaseExtensions.CommandParameter="{Binding}"/>
</ItemsControl.ItemTemplate>
</ItemsControl>
そして私が手:もちろん
System.Windows.Data Error: BindingExpression path error: 'MyViewModel' property not found on '...' '...' (HashCode=77119633). BindingExpression: Path='MyViewModel.ChooseCommand' DataItem='...' (HashCode=77119633); target element is 'System.Windows.Controls.Button' (Name=''); target property is 'Command' (type 'System.Windows.Input.ICommand')..
、私は絶対的な結合または相対いずれかを使用する必要があり、しかし私はそれをする方法を知らない。任意のヘルプ
良いアイデア、少し醜いです^^でも、うまくいきました、ありがとう – Tim