Hello @Manu Michael Samuel , Welcome to Microsoft Q&A
Trying to get the mouse Coordinate on clicked in UWP
For your scenario, you could detect Image control's Tapped event with x:bind way within MVVM architecture design. And get position relative to current page like the following.
<Grid>
<Image Source="ms-appx:///Assets/test.PNG" Stretch="Fill" Tapped="{x:Bind Image_Tapped}" />
</Grid>
Code behind
private void Image_Tapped(object sender, TappedRoutedEventArgs e)
{
var point = e.GetPosition(this);
}
Update
public class ViewModel
{
public ViewModel()
{
}
public void Image_Tapped(object sender, TappedRoutedEventArgs e)
{
var point = e.GetPosition(Window.Current.Content);
}
}
Usage
<Page.DataContext>
<local:ViewModel x:Name="MyViewModel" />
</Page.DataContext>
<Grid>
<Image
Source="ms-appx:///Assets/test.PNG"
Stretch="Fill"
Tapped="{x:Bind MyViewModel.Image_Tapped}" />
</Grid>
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.