internal static IVisualElementRenderer CreateRenderer(VisualElement element) { IVisualElementRenderer renderer = Forms.GetHandlerForObject <IVisualElementRenderer>(element) ?? new DefaultRenderer(); renderer.SetElement(element); return(renderer); }
GestureHandler CreateHandler(IGestureRecognizer recognizer) { if (recognizer is TapGestureRecognizer) { return(new TapGestureHandler(recognizer)); } else if (recognizer is PinchGestureRecognizer) { return(new PinchGestureHandler(recognizer)); } else if (recognizer is PanGestureRecognizer) { return(new PanGestureHandler(recognizer)); } else if (recognizer is SwipeGestureRecognizer) { return(new SwipeGestureHandler(recognizer)); } else if (recognizer is DragGestureRecognizer) { return(new DragGestureHandler(recognizer, _renderer)); } else if (recognizer is DropGestureRecognizer) { return(new DropGestureHandler(recognizer, _renderer)); } return(Forms.GetHandlerForObject <GestureHandler>(recognizer, recognizer)); }
public static async Task <bool> LoadFromImageSourceAsync(this EImage image, ImageSource source) { IImageSourceHandler handler; bool isLoadComplate = false; if (source != null && (handler = Forms.GetHandlerForObject <IImageSourceHandler>(source)) != null) { isLoadComplate = await handler.LoadImageAsync(image, source); } if (!isLoadComplate) { //If it fails, call the Load function to remove the previous image. image.Load(string.Empty); } return(isLoadComplate); }
GestureHandler CreateHandler(IGestureRecognizer recognizer) { return(Forms.GetHandlerForObject <GestureHandler>(recognizer, recognizer)); }