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 } }; }