コード例 #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>
 /// <see cref="T:Xamarin.Forms.Platform.Android.PageRenderer"/> override that is called whenever the
 /// <see cref="T:Xamarin.Forms.ContentPage.PropertyChanged"/> event is fired
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">E.</param>
 protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == ContentPageGloss.BackgroundGradientProperty.PropertyName)
     {
         Gradient bkgrndGradient = ContentPageGloss.GetBackgroundGradient(Element);
         if (bkgrndGradient != null)
         {
             bkgrndGradient.AttachRenderer(ContentPageGloss.BackgroundGradientProperty.PropertyName, this);
         }
     }
 }