Reputation: 4847
I'm not sure if this is a bug or if I'm doing something wrong. I have a Xamarin.Forms application which I am migrating to MAUI. I have a ScrollViewRenderer which I am adding to my project. For the sake of simplicity I have reduced the ScrollViewRenderer to be empty, as shown in the following code:
public class StyledScrollViewRenderer : ScrollViewRenderer
{
public StyledScrollViewRenderer(Context context) : base(context)
{
}
}
I enable this renderer with the following line:
builder
.UseMauiApp<App>()
...
.ConfigureMauiHandlers(handlers =>
{
#if ANDROID
handlers.AddCompatibilityRenderer(typeof(ScrollView), typeof(StyledScrollViewRenderer));
#endif
})
If I run my application with the StyledScrollViewRenderer added, the contents of all scroll views are empty. If I comment out the AddCompatibilityRenderer, all contents in all ScrollViews render correctly.
Am I misunderstanding something about scrollViewRenderers? I was under the impression that these could be used to modify the existing appearance and behavior of particular views, but perhaps ScrollViewRenderer requires additional code for default rendering?
Upvotes: 1
Views: 529
Reputation: 4847
Unfortunately I was unable to figure out how to solve this using the same renderer that I used in Xamarin.Forms, but it seems as if using a ScrollViewHandler (the new MAUI way of doing Renderers) seems to work well. I followed this answer to get past the issue I was having.
Migrate simple Custom Renderer from Xamarin.Forms to .NET MAUI
Upvotes: 1