これが私の状況です:
<ListBox ItemsSource="{Binding Path=AvailableUsers}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Id}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Command="{Binding Path=Load}" CommandParameter={???? What goes here ????}/>
私が欲しいのは、ListBox で現在選択されている Id を渡すことです。基本的に次のようなビューモデルが舞台裏にあります。
public class ViewModel : DependencyObject
{
ICommand Load { get; set; }
// dependency property but I didn't bother to write it out like one
List<User> AvailableUsers { get; set}
}
xamlを使用して現在選択されているアイテムを送信するにはどうすればよいですか?