mariusmuntean / BeforeAndAfter

Xamarin.Forms custom control showing a before-and-after view
MIT License
25 stars 4 forks source link

XF 4.x support #1

Open jdluzen opened 4 years ago

jdluzen commented 4 years ago

Hello and thanks for this great project!

After directly using the nuget package in my project, neither the BeforeAfter.BeforeView nor BeforeAfter.AfterView showed up.

I ran your sample app which ran successfully on XF 3.3. I then updated the packages to XF 4.4, and the Before/AfterView stopped showing up.

image

jdluzen commented 4 years ago

On XF 3.3, OnSizeAllocated is called with what looks like proper values, ~314 in my case. On XF 4.4 OnSizeAllocated is called with 1, 1.

jdluzen commented 4 years ago

I've spent a good amount of time debugging this, and it seems to be isolated to the ContentPresenter. The view isn't being rendered at all. I'm unsure what has changed since XF 3.3.

gsgou commented 1 year ago

@jdluzen, @mariusmuntean did you by chance find any workaround? Just noticed the issue persists also on 5.0.0.2515.

gsgou commented 1 year ago

@jdluzen, @mariusmuntean send a PR with a fix.

The ContentPresenter should be placed in a control template to mark where content to be displayed by the templated custom control will appear. I replaced it with a ContentView.

https://learn.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/templates/control-template#substitute-content-into-a-contentpresenter