void UpdateEffectColor() { var color = VisualFeedbackEffect.GetFeedbackColor(Element); alpha = color.A < 1.0f ? 1f : 0.1f; layer.BackgroundColor = color.ToUIColor(); }
void UpdateEffectColor() { var color = VisualFeedbackEffect.GetFeedbackColor(Element); var nativeColor = color.ToAndroid(); nativeColor.A = 80; ripple?.SetColor(GetPressedColorSelector(nativeColor)); }
public MaterialTabViewItemTemplate() { visualFeedback = new VisualFeedbackEffect(); Effects.Add(visualFeedback); RowSpacing = 0; HorizontalOptions = LayoutOptions.FillAndExpand; VerticalOptions = LayoutOptions.FillAndExpand; RowDefinitions.Add(new RowDefinition { Height = GridLength.Star }); RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); icon = new Image { Aspect = Aspect.AspectFit, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Margin = new Thickness(0, 6) }; text = new Label { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Margin = new Thickness(0, 6) }; badge = new TabBadgeView { PlacementTarget = icon, Margin = new Thickness(0) }; Children.Add(icon); Children.Add(text); Children.Add(badge); SetRow(icon, 0); SetRow(text, 1); SetRow(badge, 0); SetRowSpan(badge, 2); }
public CupertinoTabViewItemTemplate() { visualFeedback = new VisualFeedbackEffect(); Effects.Add(visualFeedback); RowSpacing = 0; HorizontalOptions = LayoutOptions.FillAndExpand; VerticalOptions = LayoutOptions.FillAndExpand; RowDefinitions.Add(new RowDefinition { Height = GridLength.Star }); RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto }); icon = new Image { Aspect = Aspect.AspectFit, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Margin = new Thickness(0, 6) }; text = new Label { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Margin = new Thickness(0, 6) }; badge = new TabBadgeView { PlacementTarget = icon, Margin = new Thickness(0) }; Children.Add(icon); Children.Add(text); Children.Add(badge); SetRow(icon, 0); SetRow(text, 1); SetRow(badge, 0); SetRowSpan(badge, 2); }
protected override void OnParentSet() { base.OnParentSet(); BindingContext = Parent; icon.SetBinding(Image.SourceProperty, "CurrentIcon"); text.SetBinding(Label.TextProperty, "Text"); text.SetBinding(Label.TextColorProperty, "CurrentTextColor"); text.SetBinding(Label.FontSizeProperty, "CurrentFontSize"); text.SetBinding(Label.FontAttributesProperty, "CurrentFontAttributes"); badge.SetBinding(TabBadgeView.BackgroundColorProperty, "CurrentBadgeBackgroundColor"); badge.SetBinding(TabBadgeView.BorderColorProperty, "CurrentBadgeBorderColor"); badge.SetBinding(TabBadgeView.TextProperty, "BadgeText"); badge.SetBinding(TabBadgeView.TextColorProperty, "BadgeTextColor"); VisualFeedbackEffect.SetFeedbackColor(this, Color.White); }
protected override void OnParentSet() { base.OnParentSet(); BindingContext = Parent; icon.SetBinding(Image.SourceProperty, "CurrentIcon"); text.SetBinding(Label.TextProperty, "Text", BindingMode.OneWay, new TextCaseConverter { Type = TextCaseType.Upper }); text.SetBinding(Label.TextColorProperty, "CurrentTextColor"); text.SetBinding(Label.FontSizeProperty, "CurrentFontSize"); text.SetBinding(Label.FontAttributesProperty, "CurrentFontAttributes"); text.SetBinding(Label.FontFamilyProperty, "CurrentFontFamily"); badge.SetBinding(TabBadgeView.BackgroundColorProperty, "CurrentBadgeBackgroundColor"); badge.SetBinding(TabBadgeView.TextProperty, "BadgeText"); badge.SetBinding(TabBadgeView.TextColorProperty, "BadgeTextColor"); VisualFeedbackEffect.SetFeedbackColor(this, Color.White); }