<ListBox x:Name="List" ItemsSource="{Binding ListItemsSource}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Name}" FontSize="30" /> <Button Content="Like" x:Name="btnLike" IsEnabled="{Binding Like,Mode=TwoWay}" > <i:Interaction.Triggers> <i:EventTrigger EventName="Click"> <i:InvokeCommandAction Command="{Binding SetLikeButtonCommand}" CommandParameter="{Binding Path=DataContext, ElementName=btnLike}"/> </i:EventTrigger> </i:Interaction.Triggers> </Button> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> <i:Interaction.Triggers> <i:EventTrigger EventName="SelectionChanged"> <i:InvokeCommandAction Command="{Binding SetCountryIdCommand}" CommandParameter="{Binding Path=SelectedItem, ElementName=List}"/> </i:EventTrigger> </i:Interaction.Triggers> </ListBox>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)