/// <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(); }
/// <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); }
/// <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); }
/// <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); }