WPF: Capture Click Coordinates of an Image in an ItemsControl

It can be tricky to get the click coordinates of a control inside an ItemsControl. Here is how you do it: XAML: <ItemsControl Name=”FileImages”> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation=”Horizontal” /> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate> <Image Name=”FileImage” Source=”{Binding}” Focusable=”True” MouseUp=”FileImage_OnMouseUp” /> </DataTemplate>…