get clicked button content from button styled listbox binded to xml
Hi I have a listbox binded to a xml file, and each item I gave them a button data template so I can easily register a click event to each item. I would love to get the clicked button's content to do some query on. Here is my code XAML <ListBox Name="listBox1" > <ListBox.ItemsSource> <Binding Source="{StaticResource keywordLib}" XPath="Position/Keyword/Word"/> </ListBox.ItemsSource> <ListBox.ItemTemplate> <DataTemplate> <Button Content="{Binding}" Click="keyword_Click"/> </DataTemplate> </ListBox.ItemTemplate> </ListBox> After hours of googling for solutions. I know I should use sender from the