Click here to Skip to main content
15,895,192 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good day.

I have the following ScrollViewer control that houses a dockpanel, who's child elements are images. I can capture a double click on the scrollviewer, but I want to know how to find which child image is being double clicked.

XML
<scrollviewer name="svScreenshots" grid.row="3" grid.column="1" grid.rowspan="2" grid.columnspan="2">
                      VerticalScrollBarVisibility="Disabled" HorizontalScrollBarVisibility="Hidden" 
                      MouseMove="svScreenshots_MouseMove" CanContentScroll="False" 
                      HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" 
                      PanningMode="HorizontalOnly" PanningDeceleration="10" Margin="10,10,30,10" 
                      IsDeferredScrollingEnabled="False" 
                      uc:KineticBehaviour.HandleKineticScrolling="True" MouseDoubleClick="svScreenshots_MouseDoubleClick">
            <dockpanel name="imgDockPanel" lastchildfill="False" removed="#FFCEC9C9" margin="5" mousedown="imgDockPanel_MouseDown" />
        </scrollviewer>


How can this be done?

Thank you,

Jib
Posted
Updated 22-Aug-11 23:49pm
v2

1 solution

MouseButtonEventArgs[^] has a property called OriginalSource which will be the actually clicked element.
 
Share this answer
 
Comments
Jibrohni 23-Aug-11 11:17am    
It seems to report e.originalsource as the scrollviewer. Maybe because the images are added at runtime in code behind.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900