Wpf Windows Phone-将UserControl的按钮绑定到ViewModel

Wpf Windows Phone-将UserControl的按钮绑定到ViewModel,wpf,xaml,windows-phone-8,mvvm,mvvm-light,Wpf,Xaml,Windows Phone 8,Mvvm,Mvvm Light,我正在努力将位于ListBox.ItemTemplate内的UserControl内的按钮绑定到我的ViewModel 页面A包含以下列表框: <ListBox x:Name="lbUpcomingBetgames" ItemsSource="{Binding UpcomingBetgames}" Background="{x:Null}"> <ListBox.ItemContainerStyle>

我正在努力将位于ListBox.ItemTemplate内的UserControl内的按钮绑定到我的ViewModel

页面A包含以下列表框:

<ListBox x:Name="lbUpcomingBetgames" ItemsSource="{Binding UpcomingBetgames}" Background="{x:Null}">
                <ListBox.ItemContainerStyle>
                    <Style TargetType="ListBoxItem">
                        <Setter Property="HorizontalAlignment" Value="Stretch"/>
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                        <Setter Property="Margin" Value="0,4,0,4"/>
                    </Style>
                </ListBox.ItemContainerStyle>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <customControl:BetgameInfoControl x:Name="upcomingBetgameControl" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
My CustomControl包含一个按钮:

<Button Grid.Row="0" Content="Accept" Height="50" Command="{Binding Path=Parent.DataContext.BetgameRegisterClicked, ElementName=upcomingBetgameControl}" CommandParameter="{Binding Description}" />
从不调用RelayCommand。我尝试了不同的方法来绑定按钮中的Command属性,但没有任何效果


有人能帮我吗?

您需要像这样更改按钮的数据上下文=>

DataContext={Binding ElementName=lbUpcomingBetgames,path=DataContext.BetgameRegisterClicked}

检查这个问题谢谢你的回答。它仍然不起作用。如何设置按钮的Command属性?对不起,我失败了^^replace Datacontext={by Command={我以前也试过,但它也不起作用:还有其他建议吗?
DataContext={Binding ElementName=lbUpcomingBetgames,path=DataContext.BetgameRegisterClicked}