I have an image so when I tap on the image it should open me a dialogue box with two buttons saying Camera or Gallery so the user can select to choose whether he wants to take a picture from camera or use already existing image from gallery.
I m using GestureListener to listen to Tap event.
<Image Margin="88.687,189.769,58.674,340.698" Grid.Row="1" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" d:LayoutRounding="Auto" Source="feet,vintage,music,girl,girl,guitar,jeans-7285bdf005743617f8892359619b148a_h.jpg" Stretch="UniformToFill">
<Image.RenderTransform>
<CompositeTransform Rotation="-8.33"/>
</Image.RenderTransform>
<toolkit:GestureService.GestureListener>
<toolkit:GestureListener Tap="GestureListener_Tap" />
</toolkit:GestureService.GestureListener>
</Image>
But I dont know how to invoke the dialogue box if the user tap on the image. Or Is it possible I could use context menu to select camera or gallery.
please suggest
Instead of adding the Gesture Listener , you can just add an event handler to the Tap event of the image control .
< Image Tap = "MyImageTap" name="MyImage"> < /Image>
from the XAML . Or you can do the same in code by: MyImage.Tap += new RoutedEventHandler(MyImageTap);
from the XAML . Or you can do the same in code by: MyImage.Tap += new RoutedEventHandler(MyImageTap);
Then in the event handler function, you can perform the desired logic.
If you want a ContextMenu
you should use the ContextMenu
from the Silverlight Toolkit as you're already attempting to use for the GestureListener.
Then you can assign two different commands, one for opening the CameraCaptureTask
or another for opening the PhotoChooserTask
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.