Hi all
We have a shared page defined in the PCL project. Lets call it SharedView, which is an empty ContentPage (XAML or code, doesn't make a difference).
We then use a PageRenderer on each platform to create a platform-specific layout.
On Windows Phone project (Windows Phone Silverlight 8.1) we have our CustomPage that should be displayed in place of SharedPage.
Our PageRenderer adds the CustomPage to the display as follow:
[assembly: ExportRenderer(typeof(SharedPage), typeof(CustomPageRenderer))]
namespace TestOrientationChanges.WinPhone
{
public class CustomPageRenderer : PageRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);
this.Children.Add(new CustomPage());
}
}
}
This works in the sense that the CustomPage is displayed.
Our problem however is that it does not respond to the OrientationChanged event of the CustomPage, and the SharedPage does not have a similar event that we can leverage.
We need to react on the OrientationChanged event and update UI according to current Orientation.
The CustomPage's SupportedOrientation is set to PortraitOrLandscape, and we have tried doing the event subscriptions in code and in XAML, with the same result.
The SizeChanged and LayoutChanged events fire, so it is not all events are broken.
Even though these events are triggered in the CustomPage, they are too broad for us to use, plus it does not give us the correct current Orientation.
We tried using the SizeChanged event, but that doesn't get fired if there is a change from LandscapeLeft to LandscapeRight and vice versa.
Environment Description:
Xamarin 3.11.590.0 (5160db7)
Xamarin.Android 5.1.3.1 (d419c934e6ce2113653ff4c40214e3a5d5a69440)
Xamarin.Forms Intellisense 1.0
Xamarin.iOS 8.10.1.0 (fce006eae308515fc1eaf85fcc0f90699d9c7e8b)
Xamarin.iOS Unified Migration 1.0
Xamarin.TestCloud.Integration 1.0
Any help would be greatly appreciated!
Thanks
Dieter