Forms2Native Example for WinPhone 8.1 Xaml (WinRT)

zahikramerzahikramer ILMember ✭✭✭
edited July 2015 in Xamarin.Forms

Hi.
I'm trying to implement the same pattern in Forms2Native example for WinPhone Silverlight that in the example...
But.
There is no Childern property.
in the example:

`public class MySecondPageRenderer : PageRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Page> e)
{
base.OnElementChanged(e);

        var page = e.NewElement as MySecondPage;

        var stkpanel = new System.Windows.Controls.StackPanel();
        stkpanel.Orientation = System.Windows.Controls.Orientation.Horizontal;

        var label = new System.Windows.Controls.TextBlock
        {
            Text = "2" + page.Heading
        };

        stkpanel.Children.Add(label);

        this.Children.Add(stkpanel);
    }`

but for winPhone 8.1 WinRT , PageRenderer is implemented with:

protected override void OnElementChanged(VisualElementChangedEventArgs e)

so i guess there is no Panel to have Childern property.

Does anyone knows how to inject native control with this PageRenderer?
Is there any example out there for Forms2native for WinPhone 8.1 WinRT?

Thanks

Best Answer

  • MichaelRumplerMichaelRumpler AT ✭✭✭✭✭
    edited July 2015 Accepted Answer

    You can use ((Windows.UI.Xaml.Controls.Canvas)ContainerElement).Children within the PageRenderer.
    Unfortunately these property names are not consistent.

Answers

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭
    edited July 2015 Accepted Answer

    You can use ((Windows.UI.Xaml.Controls.Canvas)ContainerElement).Children within the PageRenderer.
    Unfortunately these property names are not consistent.

  • zahikramerzahikramer ILMember ✭✭✭

    Thanks very much @MichaelRumpler
    I thought so,
    and even think to make an new Custom Custom Renderer with a Grid Instead of Canvas.
    Do you know that kind of implementation?
    (who is using canvas these days... ? why not use Grid which
    i can make header , footer , margins etc....??)

  • MichaelRumplerMichaelRumpler ATMember ✭✭✭✭✭
    edited July 2015

    Sorry, I only know that the ContainerElement is a Canvas in Xamarins PageRenderer. I don't know why.

  • TamasMatraiTamasMatrai HUUniversity ✭✭
    edited August 2015

    Any development about this question? It is really annoying to use canvas, drives me crazy when try to align things from XAML.

    I am also very dissapointed with XF WinRT documentation and lack of features (like no map support out of the box). Xamarin has a strong relationships with Microsoft, so it is really strange, that WP / WinRT is the weakest part of Xamarin.

    Thanks!

  • zahikramerzahikramer ILMember ✭✭✭

    @TamasMatrai
    You are right. there is annoying lack of support on winRT especially now when win 10 is out .
    we should ask Xamarin what is the RoadMap regarding this....

Sign In or Register to comment.