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

Xamarin Forms page custom renderer fails to cast ContainerElement as Canvas

$
0
0

As written in title.. When i try to make a platform specific rendering of a WP page, the ContainerElement gets cast to null - but its not really null - it contains lots of properties, but still i cant add a view to it. Page:

namespace XamarinClients.View

{
public class VideoPlayerView : ContentPage
{
public VideoPlayerView()
{

    }
}

}
Renderer :

[assembly: ExportRenderer(typeof(VideoPlayerView), typeof(VideoPlayerPageRenderer))]
namespace XamarinClients.WinPhone.Specific
{

public class VideoPlayerPageRenderer : PageRenderer
{
public VideoPlayerPageRenderer()
{

    }
    protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Page> e)
    {
        base.OnElementChanged(e);
        Canvas content = ContainerElement as Canvas;

    }
}

}
As i mentioned - content is null - but i expand it, it contains a lot of static members.

I tried this code in another project - and there was no problems what so ever.. Any suggestions? Heres some screen shots:


Viewing all articles
Browse latest Browse all 77050

Trending Articles



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