How to search native control inside PageRenderer

zahikramerzahikramer ILMember ✭✭✭

Hi.
I want to inject new native control inside XF page.
I can do it via PageRenderer.

But i can't figure how to search the visualtree.

anyone?

Best Answer

Answers

  • adamkempadamkemp USInsider, Developer Group Leader mod

    What do you mean by "search the visual tree"? What are you trying to do?

  • zahikramerzahikramer ILMember ✭✭✭
    edited July 2015

    for example,
    in PageRenderer:
    protected override void OnElementChanged (VisualElementChangedEventArgs e) { base.OnElementChanged (e); var page = e.NewElement as CropperPage; var view = NativeView; var label = new UILabel (new RectangleF(20, 40, view.Frame.Width-40, 40)); label.AdjustsFontSizeToFitWidth = true; label.TextColor = UIColor.White;

    I can access the containerElement:
    Canvas nativeCanvas= this.ContainerElement as Canvas;

    and now i need to find some grid i planted on XF page:
    image

  • adamkempadamkemp USInsider, Developer Group Leader mod

    For what purpose? That is a very strange request, and I think you are looking at the wrong approach here.

  • zahikramerzahikramer ILMember ✭✭✭
    edited July 2015

    I want to attach some control to the Top.
    some control to the bottom.

    So i inserted a grid to XF page.
    and now from the Native Platform i want to inject native control to the upper row
    of the grid, and to the lower row of the grid.

  • adamkempadamkemp USInsider, Developer Group Leader mod

    In that case you should have two custom renderers, and you should insert those into the UI from within the PCL.

  • zahikramerzahikramer ILMember ✭✭✭
    edited July 2015

    From the PCL?
    I cannot do that.
    the control i want to inject is native (WP8, ios, android).

    also , if i put it on PCL , how can i track it from native? this was my question.
    if i insert Grid from the PCL (GRID of XF),
    then , how i can get it from the custom renderer to inject a native control to the 3rd row of it (for example)?

    Thanks for your concern @adamkemp :)

  • zahikramerzahikramer ILMember ✭✭✭

    ok.
    I understand what you are saying
    you say to switch concept.

    Instead to make a custom PAGE Renderer and to try figure all the layout on the native
    platform,
    to do all the layout on the PCL , and to make custom CONTROL renderer , and only that
    control to override on the native platform.

    i'll try it, thanks :)

Sign In or Register to comment.