Esempio n. 1
0
 public void Render(TagBuilder element, TooltipConfig config)
 {
     if(config != null)
     {
         element.Attributes.Add("data-toggle", "tooltip");
         element.Attributes.Add("data-html", "true");
         element.Attributes.Add("title", config.Content);
         element.Attributes.Add("data-placement", config.Placement.ToString().ToLower());
         element.Attributes.Add("data-trigger", config.Trigger.ToString().ToLower());
         element.Attributes.Add("data-delay", $"{{ \"show\": {config.ShowDelay}, \"hide\": {config.HideDelay}  }}");
     }
 }
Esempio n. 2
0
        public void ShowTooltip(Xamarin.Forms.View onView, TooltipConfig config)
        {
            var control = GetOrCreateRenderer(onView).View;

            if (!string.IsNullOrEmpty(config.Text))
            {
                ToolTip.Builder builder;
                var             position      = config.Position;
                var             parentContent = control.RootView;
                switch (position)
                {
                case TooltipPosition.Top:
                    builder = new ToolTip.Builder(global::Android.App.Application.Context, control,
                                                  parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionAbove);
                    break;

                case TooltipPosition.Left:
                    builder = new ToolTip.Builder(global::Android.App.Application.Context, control,
                                                  parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionLeftTo);
                    break;

                case TooltipPosition.Right:
                    builder = new ToolTip.Builder(global::Android.App.Application.Context, control,
                                                  parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionRightTo);
                    break;

                default:
                    builder = new ToolTip.Builder(global::Android.App.Application.Context, control,
                                                  parentContent as ViewGroup, config.Text.PadRight(80, ' '), ToolTip.PositionBelow);
                    break;
                }

                builder.SetAlign(ToolTip.AlignLeft);
                builder.SetBackgroundColor(config.BackgroundColor.ToAndroid());
                builder.SetTextColor(config.TextColor.ToAndroid());

                toolTipView = builder.Build();

                _toolTipsManager?.Show(toolTipView);
            }
        }
Esempio n. 3
0
        public void ShowTooltip(View onView, TooltipConfig config)
        {
            var control = GetOrCreateRenderer(onView).NativeView;

            var text = config.Text;

            if (!string.IsNullOrEmpty(text))
            {
                tooltip.BubbleColor     = config.BackgroundColor.ToUIColor();
                tooltip.ForegroundColor = config.TextColor.ToUIColor();
                tooltip.Text            = new Foundation.NSString(text);
                var position = config.Position;
                switch (position)
                {
                case TooltipPosition.Top:
                    tooltip.ArrowPosition = EasyTipView.ArrowPosition.Bottom;
                    break;

                case TooltipPosition.Left:
                    tooltip.ArrowPosition = EasyTipView.ArrowPosition.Right;
                    break;

                case TooltipPosition.Right:
                    tooltip.ArrowPosition = EasyTipView.ArrowPosition.Left;
                    break;

                default:
                    tooltip.ArrowPosition = EasyTipView.ArrowPosition.Top;
                    break;
                }
                var window = UIApplication.SharedApplication.KeyWindow;
                var vc     = window.RootViewController;
                while (vc.PresentedViewController != null)
                {
                    vc = vc.PresentedViewController;
                }

                tooltip?.Show(control, vc.View, true);
            }
        }
 internal MvcCoreBootstrapTooltipBuilder(TooltipConfig config)
 {
     _config = config;
 }