Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

What is a ViewRenderer ? Can I derive from it as renderer and get access to view?

$
0
0

In Xamarin Forms, I'm trying to create a custom renderer for Android that renders my custom Xamarin forms control (MyControl) with MyView. My renderer is extending ViewRenderer<MyControl, MyView>. I don't understand the relationship between the renderer (the derived class I'm creating) and the view (MyView - part of what's passed to what I'm deriving from). I Understand that the renderer is what renders the control to the view, except that I'm not doing any drawing in the renderer- all this is done in the MyView OnDraw(Canvas c) call - and I'm drawing a bunch of things already in here. However, now I am trying to get gestures going with this view. In OnElementChanged(ElementChangedEventArgs e), I check if e.OldElement == null and if yes I add a touch handler. This function is getting called.

Now I'd like to draw a circle at that position and don't know how to, because I don't know how to get a pointer to my view. Can anyone help?

Many thanks,
Mike


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>