C# How to Identify Caller for Template Events
- by mikeknoop
I have a ListBox container data bound and templatized as so:
<ListBox x:Name="ListBox"
ItemsSource="{Binding Source={StaticResource List}}"
ItemTemplate="{StaticResource ListTemplate}">
</ListBox>
Within my ListTemplate resource, I define a Grid which contains a few child elements. I have setup a click event handler on one of child elements. The event hander is not row-specific, and I need a (best practice) way of identifying which row in the ListBox the event fired upon.
From my data source, I have an unique ID which corresponds to the row. I do not currently expose this ID in the data binding, though could. Ideally I would like the event handler to be able to identify the ID of the row the event was fired upon.
Thank you!