コード例 #1
0
        /// <summary>
        /// <see cref="T:Xamarin.Forms.Platform.iOS.PageRenderer"/> override that is called whenever the associated
        /// <see cref="T:Xamarin.Forms.ContentPage"/> instance changes
        /// </summary>
        /// <param name="e"><see cref="T:Xamarin.Forms.Platform.iOS.VisualElementChangedEventArgs"/> that specifies the
        /// previously and newly assigned <see cref="T:Xamarin.Forms.ContentPage"/> instances
        /// </param>
        protected override void OnElementChanged(VisualElementChangedEventArgs e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                e.OldElement.PropertyChanging -= OnElementPropertyChanging;
                e.OldElement.PropertyChanged  -= OnElementPropertyChanged;

                Gradient bkgrndGradient = ContentPageGloss.GetBackgroundGradient(e.OldElement);
                if (bkgrndGradient != null)
                {
                    bkgrndGradient.DetachRenderer(this);
                }
            }

            if (e.NewElement != null)
            {
                e.NewElement.PropertyChanging += OnElementPropertyChanging;
                e.NewElement.PropertyChanged  += OnElementPropertyChanged;

                Gradient bkgrndGradient = ContentPageGloss.GetBackgroundGradient(Element);
                if (bkgrndGradient != null)
                {
                    bkgrndGradient.AttachRenderer(ContentPageGloss.BackgroundGradientProperty.PropertyName,
                                                  this);
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Private event handler that is called whenever a <see cref="T:Xamarin.Forms.BindableObject.PropertyChanging"/>
 /// event is fired.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="args">Property changing event arguments</param>
 void OnElementPropertyChanging(object sender, Xamarin.Forms.PropertyChangingEventArgs args)
 {
     if (args.PropertyName == ContentPageGloss.BackgroundGradientProperty.PropertyName)
     {
         Gradient bkgrndGradient = ContentPageGloss.GetBackgroundGradient(Element);
         if (bkgrndGradient != null)
         {
             bkgrndGradient.DetachRenderer(this);
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Dispose any created resources and prepare the instance for garbage collection
        /// </summary>
        /// <param name="disposing">If set to <c>true</c>, dispose any created resources</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                Gradient bkgrndGradient = ContentPageGloss.GetBackgroundGradient(Element);
                if (bkgrndGradient != null)
                {
                    bkgrndGradient.DetachRenderer(this);
                }
            }

            base.Dispose(disposing);
        }