So I'm using a button in the DataTemplate
of my Listbox
ItemTemplate
. Any ideas how I would grab the index of the item of the Listbox
from the button click? I can't see to grab the button's parent.
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type local:Img}">
<Button Click="lstButton_Click">...
You could add a
Index
property in your view model and set it when you add the view model object into your collection. And then you can access it in your event handler.