void OnButtonClicked(object sender, EventArgs args)
        {
            if (isLabelTeal)
            {
                Color color = Color.Default;
                switch (Device.RuntimePlatform)
                {
                case Device.iOS:
                    color = Color.Black;
                    break;

                case Device.Android:
                    color = Color.White;
                    break;

                case Device.UWP:
                    color = Color.Red;
                    break;
                }

                ShadowEffect.SetColor(label, color);
                isLabelTeal = false;
            }
            else
            {
                ShadowEffect.SetColor(label, Color.Teal);
                isLabelTeal = true;
            }
        }
Exemple #2
0
        public HomePageCS()
        {
            label = new Label {
                Text              = "Label Shadow Effect",
                FontAttributes    = FontAttributes.Bold,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };
            ShadowEffect.SetHasShadow(label, true);
            ShadowEffect.SetColor(label, Device.OnPlatform(Color.Black, Color.White, Color.White));
            ShadowEffect.SetRadius(label, 5);
            ShadowEffect.SetDistanceX(label, 5);
            ShadowEffect.SetDistanceY(label, 5);

            var button = new Button {
                Text = "Change Shadow Color", VerticalOptions = LayoutOptions.EndAndExpand
            };

            button.Clicked += OnButtonClicked;

            Content = new Grid {
                Padding  = new Thickness(0, 20, 0, 0),
                Children =
                {
                    new Label {
                        Text              = "Effects Demo",
                        FontAttributes    = FontAttributes.Bold,
                        HorizontalOptions = LayoutOptions.Center
                    },
                    label,
                    button
                }
            };
        }
        public HomePageCS()
        {
            label = new Label
            {
                Text              = "Label Shadow Effect",
                FontAttributes    = FontAttributes.Bold,
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.CenterAndExpand
            };

            Color color = Color.Default;

            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                color = Color.Black;
                break;

            case Device.Android:
                color = Color.White;
                break;

            case Device.UWP:
                color = Color.Red;
                break;
            }

            ShadowEffect.SetHasShadow(label, true);
            ShadowEffect.SetColor(label, color);
            ShadowEffect.SetRadius(label, 5);
            ShadowEffect.SetDistanceX(label, 5);
            ShadowEffect.SetDistanceY(label, 5);

            var button = new Button {
                Text = "Change Shadow Color", VerticalOptions = LayoutOptions.EndAndExpand
            };

            button.Clicked += OnButtonClicked;

            Content = new Grid
            {
                Padding  = new Thickness(0, 20, 0, 0),
                Children =
                {
                    new Label {
                        Text              = "Effects Demo",
                        FontAttributes    = FontAttributes.Bold,
                        HorizontalOptions = LayoutOptions.Center
                    },
                    label,
                    button
                }
            };
        }
Exemple #4
0
 void OnButtonClicked(object sender, EventArgs args)
 {
     if (isLabelTeal)
     {
         ShadowEffect.SetColor(label, Device.OnPlatform(Color.Black, Color.White, Color.Red));
         isLabelTeal = false;
     }
     else
     {
         ShadowEffect.SetColor(label, Color.Teal);
         isLabelTeal = true;
     }
 }