<StackPanel>
<!--<Button Command="{Binding GetOddsCommand}" CommandParameter="{Binding}" />-->
<ListView
ItemsSource="{Binding Links}"
>
<ListView.ItemTemplate>
<DataTemplate>
<Border>
<Button Command="{Binding GetOddsCommand}" CommandParameter="{Binding}">
<TextBlock >
<Hyperlink NavigateUri="http://www.onet.pl" >
<TextBlock Text="{Binding}" />
</Hyperlink>
</TextBlock>
</Button>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
I have MVVM application. In viewmodel I have GetOddsCommand:
public ICommand GetOddsCommand
{
get
{
if (_getOddsCommand == null)
_getOddsCommand = new RelayCommand(param => GetOdds());
return _getOddsCommand;
}
}
private void GetOdds()
{
}
When I uncomment first button placed in StackPanel command works good. Debugger step into get and then when I click command Debugger step into GetOdds method. But it doesn't work in second button which is in the ListView. Looks like second button cannot see GetOddsCommand, but I don't understand why
Thanks