Example #1
0
 /// <summary>
 /// Implementation of method required by the <see cref="T:XFGloss.IXFGlossRenderer"/> interface that the
 /// <see cref="T:XFGloss.IGradientRenderer"/> interface extends. Applies the passed
 /// <see cref="T:XFGloss.XFGlossElement"/> properties to the iOS UIView.
 /// </summary>
 /// <param name="propertyName">The name of the XFGloss attached BindableProperty that changed</param>
 /// <param name="element">The <see cref="T:XFGloss.XFGlossElement"/> instance that changed</param>
 /// <typeparam name="TElement">The type <see cref="T:XFGloss.XFGlossElement"/> that changed</typeparam>
 public void CreateNativeElement <TElement>(string propertyName, TElement element) where TElement : XFGlossElement
 {
     if (element is Gradient)
     {
         // No need to check property name yet, BackgroundGradient is the only one being handled here.
         XFGlossGradientLayer.CreateGradientLayer(NativeView, element as Gradient);
     }
 }
Example #2
0
        /// <summary>
        /// Override of the UIViewController method to update the background gradient layer size whenever view layout
        /// changes occur.
        /// </summary>
        public override void ViewDidLayoutSubviews()
        {
            if (NativeView != null)
            {
                var layer = XFGlossGradientLayer.GetGradientLayer(NativeView);
                if (layer != null)
                {
                    layer.Frame = new CGRect(CGPoint.Empty, NativeView.Frame.Size);
                }
            }

            base.ViewDidLayoutSubviews();
        }
Example #3
0
 /// <summary>
 /// Implementation of method required by the <see cref="T:XFGloss.IGradientRenderer"/> interface. Updates
 /// the rotation angle being used by any existing implementation of the property specified by the propertyName
 /// parameter.
 /// </summary>
 /// <param name="propertyName">The name of the XFGloss attached BindableProperty that changed</param>
 /// <param name="rotation">The new rotation value, an integer number between 0 and 359</param>
 public void UpdateRotation(string propertyName, int rotation)
 {
     // No need to check property name yet, BackgroundGradient is the only one being handled here.
     XFGlossGradientLayer.GetGradientLayer(NativeView)?.UpdateRotation(rotation);
 }
Example #4
0
 /// <summary>
 /// Implementation of method required by the <see cref="T:XFGloss.IXFGlossRenderer"/> interface that the
 /// <see cref="T:XFGloss.IGradientRenderer"/> interface extends. Removes any existing implementation of
 /// the property specified by the propertyName parameter.
 /// </summary>
 /// <param name="propertyName">The name of the XFGloss attached BindableProperty that changed</param>
 public void RemoveNativeElement(string propertyName)
 {
     // No need to check property name yet, BackgroundGradient is the only one being handled here.
     XFGlossGradientLayer.RemoveGradientLayer(NativeView);
 }
Example #5
0
 /// <summary>
 /// Implementation of method required by the <see cref="T:XFGloss.IXFGlossRenderer"/> interface that the
 /// <see cref="T:XFGloss.IGradientRenderer"/> interface extends. Indicates if there is an existing
 /// implementation of the property specified by the propertyName parameter.
 /// </summary>
 /// <returns><c>true</c>, if an existing implementation is found, <c>false</c> otherwise.</returns>
 /// <param name="propertyName">The name of the XFGloss attached BindableProperty that changed</param>
 public bool CanUpdate(string propertyName)
 {
     // No need to check property name yet, BackgroundGradient is the only one being handled here.
     return(XFGlossGradientLayer.GetGradientLayer(NativeView) != null);
 }
Example #6
0
 /// <summary>
 /// Implementation of method required by the <see cref="T:XFGloss.IGradientRenderer"/> interface. Updates
 /// the gradient fill steps being used by any existing implementation of the property specified by the
 /// propertyName parameter.
 /// </summary>
 /// <param name="propertyName">The name of the XFGloss attached BindableProperty that changed</param>
 /// <param name="steps">The new collection of <see cref="T:XFGloss.GradientStep"/> instances that specify the
 /// colors and positions of each step of the gradient fill</param>
 public void UpdateSteps(string propertyName, GradientStepCollection steps)
 {
     // No need to check property name yet, BackgroundGradient is the only one being handled here.
     XFGlossGradientLayer.GetGradientLayer(NativeView)?.UpdateSteps(steps);
 }