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

PopToRootAsync doesn't not work in Xamarin.Form 1.3.1 with custom control

$
0
0

Hi every one
I had new project with xamarin form 1.3.
I have 3 pages (page1, page2, page3) , Page1 displays Page2 (using PopAsync), Page2 display Page3 (using PopAsync also). When I click the Close button in Page3 it will call the function PopToRootAsync so that Page3 returns Page1.
It worked fine with the normal button, however, when I try to customize the button the the Page3 with some bindable property like this:

public static readonly BindableProperty FontNameProperty =
BindableProperty.Create<CustomButton, string>(
p => p.FontName, string.Empty);
public string FontName
{
set { SetValue(FontNameProperty, value); }
get { return (string)GetValue(FontNameProperty); }
}

And in the CustomButtonRenderer in IOS, I just do like this:
protected override void OnElementChanged(ElementChangedEventArgs e)
{
base.OnElementChanged(e);
var view = (CustomButton)Element;
SetFont(view);
}

    private void SetFont(CustomButton view)
    {
        if (!string.IsNullOrEmpty(view.FontName)) ;
    }

(I haven't change the font, I just test the FontName string).
Finally, the function PopToRootAsync does not work. (You can download the attached example and test it).

Does anybody meet the same issue like ? How can I deal with this ?


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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