locked
AwakeFromNib not being called on OnElementChanged RRS feed

  • Question

  • User387240 posted

    I migrated my project to .Net Standard but I'm having an issues with an iOS rendered. The code base is the same but it fails on the .Net Standard 2.0 with the newest xamarin.forms

    I have this Rendered

    public partial class ImagesView : PageRenderer {
            protected override void OnElementChanged(VisualElementChangedEventArgs e)
            {
                base.OnElementChanged(e);
                ((ImageGalleryPage)Element).CallToNativeMethod += (sender, i) =>
                {
                    //code here
                };
            }
     public override void ViewDidLoad()
            {
            //code here
        }
    }
    

    And I have a UIColletionView with an awake from nib that should be fired up when calling the OnElementChanged on the ImagesView. This works on my old project but not on the updated one.

    public partial class ImageCollectionView : UICollectionView
        {
            public override void AwakeFromNib()
            {
                base.AwakeFromNib();
                // Initialize
            }
        }
    

    any idea why it would not fire up?

    Wednesday, July 10, 2019 5:57 PM

All replies

  • User387240 posted

    So adding more breakpoints to the code I realize, this part is not being entered, inside the OnElementChanged

    ((ImageGalleryPage)Element).CallToNativeMethod += (sender, i) =>
                {
                    CleanGalleryImages();
                    alreadyLoadedImg = false;
                };
    
    Wednesday, July 10, 2019 8:35 PM
  • User387240 posted

    So i downgraded my Xamarin.Forms and its working. Why this will happen?

    Wednesday, July 10, 2019 10:18 PM