Example #1
0
        void ReleaseDesignerOutlets()
        {
            if (FavoriteButton != null)
            {
                FavoriteButton.Dispose();
                FavoriteButton = null;
            }

            if (RecipeImage != null)
            {
                RecipeImage.Dispose();
                RecipeImage = null;
            }
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Image> args)
        {
            if (args.OldElement != null)
            {
                if (_nativeControl != null)
                {
                    _nativeControl.ImageChanged -= OnSourceImageChanged;
                    _nativeControl.Dispose();
                    _nativeControl = null;
                }
            }

            if (Control == null && args.NewElement != null)
            {
                _nativeControl = new MvxIosImageView()
                {
                    ContentMode   = UIViewContentMode.ScaleAspectFit,
                    ClipsToBounds = true
                };
                _nativeControl.ImageChanged += OnSourceImageChanged;

                SetNativeControl(_nativeControl);
            }

            if (Element.Source != null)
            {
                MvxTrace.Warning("Source property ignored on MvxImageView");
            }

            base.OnElementChanged(args);

            if (_nativeControl != null)
            {
                if (_nativeControl.ErrorImagePath != SharedControl.ErrorImagePath)
                {
                    _nativeControl.ErrorImagePath = SharedControl.ErrorImagePath;
                }

                if (_nativeControl.DefaultImagePath != SharedControl.DefaultImagePath)
                {
                    _nativeControl.DefaultImagePath = SharedControl.DefaultImagePath;
                }

                if (_nativeControl.ImageUrl != SharedControl.ImageUri)
                {
                    _nativeControl.ImageUrl = SharedControl.ImageUri;
                }
            }
        }