Windows phone 7 在RelayCommand方法中获取listboxitem的句柄

Windows phone 7 在RelayCommand方法中获取listboxitem的句柄,windows-phone-7,mvvm-light,Windows Phone 7,Mvvm Light,这是给WP7的。 我在列表框itemtemplate中有一个按钮。在关联的ViewModel中,我有RelayCommand,它绑定到按钮的Click事件(使用MVVMLight EventToCommand)。我只想在单击按钮时传入ListBox的ListItem 有什么想法吗?在xamlCommandParameter=“{Binding}”中使用,它会将所选列表项传递给命令 然后是视图模型 private RelayCommand<ListItem> _command; pu

这是给WP7的。 我在列表框itemtemplate中有一个按钮。在关联的ViewModel中,我有RelayCommand,它绑定到按钮的Click事件(使用MVVMLight EventToCommand)。我只想在单击按钮时传入ListBox的ListItem


有什么想法吗?

在xaml
CommandParameter=“{Binding}”
中使用,它会将所选列表项传递给命令

然后是视图模型

private RelayCommand<ListItem> _command;

public RelayCommand<ListItem> Command
{
    get
    {
        return _command ?? (_command = new RelayCommand(Method));
    }
}

public void Method(ListItem item)
{
    ...
}
private RelayCommand\u命令;
公共中继命令
{
得到
{
返回_命令??(_命令=新的RelayCommand(方法));
}
}
公共作废方法(列表项)
{
...
}

在xaml
CommandParameter=“{Binding}”
中使用,它将把所选列表项传递给命令

然后是视图模型

private RelayCommand<ListItem> _command;

public RelayCommand<ListItem> Command
{
    get
    {
        return _command ?? (_command = new RelayCommand(Method));
    }
}

public void Method(ListItem item)
{
    ...
}
private RelayCommand\u命令;
公共中继命令
{
得到
{
返回_命令??(_命令=新的RelayCommand(方法));
}
}
公共作废方法(列表项)
{
...
}