Putting a button and inside it a Hyperlink doesn't make much sense... What do you expect to happen when you click on the hyperlink?
Anyways, the following code will cause your command to be called:
<ListView ItemsSource="{Binding Links}" x:Name="ListView1">
<ListView.ItemTemplate>
<DataTemplate>
<Border>
<Button Command="{Binding ElementName=ListView1, Path=DataContext.GetOddsCommand}" CommandParameter="{Binding}">
<TextBlock Text="{Binding}" />
</Button>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Notice the DataContext used is that of the ListView not of the ListViewItem...
You might want to do the same kind of binding for the CommandParameter - Depends on what you're really after.
Now, adding the hyperlink inside will cause problems - if you click on the Hyperlink the button isn't really clicked so you won't get the command, if you click on an area without the hyperlink everything will be fine...
If you really do want the hyperlink there... You can set the IsHitTestVisible
of the surrounding textblock to false.
e.g.:
<TextBlock IsHitTestVisible="false">
<Hyperlink NavigateUri="http://www.onet.pl" >
<TextBlock Text="{Binding}" />
</TextBlock>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…