protected override void OnAttached()
 {
     try {
         Control.Layer.CornerRadius  = (nfloat)ShadowEffect.GetRadius(Element);
         Control.Layer.ShadowColor   = ShadowEffect.GetColor(Element).ToCGColor();
         Control.Layer.ShadowOffset  = new CGSize((double)ShadowEffect.GetDistanceX(Element), (double)ShadowEffect.GetDistanceY(Element));
         Control.Layer.ShadowOpacity = 1.0f;
     } catch (Exception ex) {
         Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
     }
 }
Exemple #2
0
 protected override void OnAttached()
 {
     try {
         var   control   = Control as Android.Widget.TextView;
         float radius    = (float)ShadowEffect.GetRadius(Element);
         float distanceX = (float)ShadowEffect.GetDistanceX(Element);
         float distanceY = (float)ShadowEffect.GetDistanceY(Element);
         Android.Graphics.Color color = ShadowEffect.GetColor(Element).ToAndroid();
         control.SetShadowLayer(radius, distanceX, distanceY, color);
     } catch (Exception ex) {
         Console.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
     }
 }
        private string GetLabelDirection()
        {
            var distanceX = ShadowEffect.GetDistanceX(Element);
            var distanceY = ShadowEffect.GetDistanceY(Element);

            if (distanceX < 0.0 && distanceY < 0.0)
            {
                return("top_left");
            }
            else if (distanceX == 0.0 && distanceY < 0.0)
            {
                return("top");
            }
            else if (distanceX > 0.0 && distanceY < 0.0)
            {
                return("top_right");
            }
            else if (distanceX > 0.0 && distanceY == 0.0)
            {
                return("right");
            }
            else if (distanceX > 0.0 && distanceY > 0.0)
            {
                return("bottom_right");
            }
            else if (distanceX == 0.0 && distanceY > 0.0)
            {
                return("bottom");
            }
            else if (distanceX < 0.0 && distanceY > 0.0)
            {
                return("bottom_left");
            }
            else if (distanceX < 0.0 && distanceY == 0.0)
            {
                return("left");
            }
            else
            {
                // platform default
                return("");
            }
        }
        protected override void OnAttached()
        {
            try {
                if (!shadowAdded)
                {
                    var textBlock = Control as Windows.UI.Xaml.Controls.TextBlock;

                    var shadowLabel = new Label();
                    shadowLabel.Text              = textBlock.Text;
                    shadowLabel.FontAttributes    = FontAttributes.Bold;
                    shadowLabel.HorizontalOptions = LayoutOptions.Center;
                    shadowLabel.VerticalOptions   = LayoutOptions.CenterAndExpand;
                    shadowLabel.TextColor         = ShadowEffect.GetColor(Element);
                    shadowLabel.TranslationX      = ShadowEffect.GetDistanceX(Element);
                    shadowLabel.TranslationY      = ShadowEffect.GetDistanceY(Element);

                    ((Grid)Element.Parent).Children.Insert(0, shadowLabel);
                    shadowAdded = true;
                }
            } catch (Exception ex) {
                Debug.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
            }
        }
 void UpdateOffset()
 {
     Control.Layer.ShadowOffset = new CGSize(
         (double)ShadowEffect.GetDistanceX(Element),
         (double)ShadowEffect.GetDistanceY(Element));
 }
Exemple #6
0
 void UpdateOffset()
 {
     distanceX = (float)ShadowEffect.GetDistanceX(Element);
     distanceY = (float)ShadowEffect.GetDistanceY(Element);
 }
Exemple #7
0
 void UpdateOffset()
 {
     shadowLabel.TranslationX = ShadowEffect.GetDistanceX(Element);
     shadowLabel.TranslationY = ShadowEffect.GetDistanceY(Element);
 }
Exemple #8
0
 private void UpdateOffset()
 {
     Control.Layer.ShadowOffset = new CGSize(ShadowEffect.GetDistanceX(Element), ShadowEffect.GetDistanceY(Element));
 }