これは愚かな質問かもしれませんが、答えが見つかりません。次の xaml では、CommandParameter
binding to とは何ですか? または、一般的には、どういう"{Binding}"
意味ですか?
<Button Command="{Binding DataContext.DeleteCommand, ElementName=List}"
CommandParameter="{Binding}"/>
ベストアンサー1
{Binding ...}
は MarkupExtension です。
通常の形式では、 のようなパス{Binding Path=someProperty, ...}
(またはその短縮形{Binding someProperty, ...}
) を取ります。
したがって、 のパスは空であり、これは、Binding が Binding の Source にバインドされていることを意味します。 が実際には と同じであることを{Binding}
知っていれば、これは少し理解しやすくなるかもしれません。{Binding}
{Binding DataContext,RelativeSource={RelativeSource Self}}
したがって、あなたの場合、CommandParameter はボタンの現在の DataContext の値を取得します。