Click here to Skip to main content
15,917,991 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,
This is How my part of mainpage.xml looks
HTML
<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>



My Problem is Event Trigger (Click)for button is not fired.
But in other hand ListBox Event trigger (SelectionChanged) is working fine.

Please help me ,What is the problem with my code ?
Posted

1 solution

 
Share this answer
 
Comments
CrystalB 9-Aug-13 3:21am    
True. But I need click event for buttons; which is inside the ListBox
virusstorm 9-Aug-13 8:37am    
Why not just use the "Click" event on the button as opposed to adding an InvokeActionCommand to it?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900