Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyImage : Xamarin.Forms.Image
- {
- public static BindableProperty OnClickProperty =
- BindableProperty.Create("OnClick", typeof(Command), typeof(MyImage));
- public Command OnClick
- {
- get { return (Command)GetValue(OnClickProperty); }
- set { SetValue(OnClickProperty, value); }
- }
- public MyImage()
- {
- GestureRecognizers.Add(new TapGestureRecognizer() {Command = new Command(DisTap)});
- }
- private void DisTap(object sender)
- {
- if (OnClick != null)
- {
- OnClick.Execute(sender);
- }
- }
- }
- <local:MyImage Source="{Binding Img}" OnClick="{Binding ImgTapCommand}" />
- <AbsoluteLayout>
- <Image Source="clock.png" AbsoluteLayout.LayoutBounds="0.2,0.2,35,35" AbsoluteLayout.LayoutFlags="PositionProportional"/>
- <Button AbsoluteLayout.LayoutBounds="0.2,0.2,35,35" AbsoluteLayout.LayoutFlags="PositionProportional" BorderColor="Transparent" BackgroundColor="Transparent" Command="{Binding AlertMeCommand}"/>
- </AbsoluteLayout>
Add Comment
Please, Sign In to add comment