Xamarin forms, DataTemplate vs Custom Renderer

Viewed 102

I have to add some elements inside a ViewCell. To do this I can choose between 2 aproaches:

1- Use DataTemplate to build the layout.

2- Use Custom Renderers.

I am trying to understand the difference between this two aproaches in situations like this.

When should I use a DataTemplate?

When should I use a Custom Renderer?

1 Answers

As Jason said:

A Custom Renderer only applies if you need platform specific UI that is not available via the standard Forms controls.

So, we should use a DataTemplate always that we can layout the elements and we don't need nothing specific from any platform to behave or be drawn like we want.

In the other hand, we should use custom renderers if we need platform specific UI that we can't layout with the standard Forms controls.

Related