private void TooltipLayout() { //ToolTip TextView tooltipLabel = new TextView(context1); tooltipLabel.TextSize = 20; tooltipLabel.SetPadding(0, 50, 0, 20); tooltipLabel.Text = "Tooltip Placement"; //ToolTip Spinner toolTipSpinner = new Spinner(context1, SpinnerMode.Dialog); toolTipSpinner.SetGravity(GravityFlags.Left); //Placement List List <String> placementList = new List <String>(); placementList.Add("None"); placementList.Add("TopLeft"); placementList.Add("BottomRight"); //Placement Adapter placementAdapter = new ArrayAdapter <String>(context1, Android.Resource.Layout.SimpleSpinnerItem, placementList); placementAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); //ToolTip Spinner Item Selected Listener toolTipSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = placementAdapter.GetItem(e.Position); toolTipSpinnerPosition = e.Position; if (selectedItem.Equals("None")) { toolTipPosition = TooltipPlacement.None; } if (selectedItem.Equals("TopLeft")) { toolTipPosition = TooltipPlacement.TopLeft; } if (selectedItem.Equals("BottomRight")) { toolTipPosition = TooltipPlacement.BottomRight; } ApplyChanges(); }; toolTipSpinner.Adapter = placementAdapter; toolTipSpinner.SetSelection(toolTipSpinnerPosition); //toolTipLayout LinearLayout toolTipLayout = new LinearLayout(context1); toolTipLayout.Orientation = Android.Widget.Orientation.Vertical; toolTipLayout.SetPadding(0, 0, 0, 50); toolTipLayout.AddView(tooltipLabel); toolTipLayout.AddView(toolTipSpinner); propertylayout.AddView(toolTipLayout); }
public override void Process(TagHelperContext context, TagHelperOutput output) { if (!String.IsNullOrWhiteSpace(Tooltip)) { output.Attributes.RemoveAll("tooltip"); output.Attributes.Add("data-toggle", "kt-tooltip"); output.Attributes.Add("data-original-title", Tooltip); output.Attributes.Add("data-container", "body"); output.Attributes.Add("data-html", "true"); if (TooltipState.IsUsed()) { output.Attributes.RemoveAll("tooltip-skin"); output.Attributes.Add("data-skin", TooltipState.ToValue()); } if (TooltipPlacement.IsUsed()) { output.Attributes.RemoveAll("tooltip-placement"); output.Attributes.Add("data-placement", TooltipPlacement.ToValue()); } if (TooltipTrigger.IsUsed()) { output.Attributes.RemoveAll("tooltip-trigger"); output.Attributes.Add("data-trigger", TooltipTrigger.ToValue()); } if (TooltipOffset != default) { output.Attributes.RemoveAll("tooltip-offset"); output.Attributes.Add("data-offset", $"{TooltipOffset.Item1}px {TooltipOffset.Item2}px"); } } }
public static IElement <Tooltip> Placement(this IElement <Tooltip> element, TooltipPlacement placement) => element.Attribute("placement", placement);
private void TooltipLayout() { /*********** **ToolTip** ***********/ TextView tooltipLabel = new TextView(context); tooltipLabel.TextSize = 20; tooltipLabel.Text = "Tooltip Placement"; LinearLayout.LayoutParams toollabelParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); toollabelParams.SetMargins(0, 10, 0, 0); //ToolTip Spinner toolTipSpinner = new Spinner(context, SpinnerMode.Dialog); toolTipSpinner.SetGravity(GravityFlags.Left); //Placement List List <String> placementList = new List <String>(); placementList.Add("None"); placementList.Add("TopLeft"); placementList.Add("BottomRight"); //Placement Adapter placementAdapter = new ArrayAdapter <String>(context, Android.Resource.Layout.SimpleSpinnerItem, placementList); placementAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); toolTipSpinner.Adapter = placementAdapter; //ToolTip Spinner Item Selected Listener toolTipSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = placementAdapter.GetItem(e.Position); if (selectedItem.Equals("None")) { toolTipPosition = TooltipPlacement.None; } if (selectedItem.Equals("TopLeft")) { toolTipPosition = TooltipPlacement.TopLeft; } if (selectedItem.Equals("BottomRight")) { toolTipPosition = TooltipPlacement.BottomRight; } }; //CenterText TextView centerText = new TextView(context); propertylayout.AddView(centerText); propertylayout.AddView(tooltipLabel); //Separator SeparatorView separate3 = new SeparatorView(context, width * 2); separate3.LayoutParameters = new ViewGroup.LayoutParams(width * 2, 5); // propertylayout.AddView(separate3, layoutParams); toolTipSpinner.SetPadding(0, 0, 0, 20); //AdjLabel TextView adjLabel3 = new TextView(context); adjLabel3.SetHeight(20); propertylayout.AddView(adjLabel3); propertylayout.AddView(toolTipSpinner); }
public static T Tooltip <T>(this T component, IComponent tooltip, bool interactive = false, TooltipAnimation animation = TooltipAnimation.ShiftAway, TooltipPlacement placement = TooltipPlacement.Top, int delayShow = 0, int delayHide = 0, bool appendToBody = true) where T : IComponent { if (tooltip is null) { return(component); } var rendered = component.Render(); var marker = new object(); (rendered as dynamic).tooltipMarker = marker; rendered.onmouseenter += AttachTooltip; void AttachTooltip(MouseEvent e) { rendered.onmouseenter -= AttachTooltip; if ((rendered as dynamic).tooltipMarker != marker) { return; } var renderedTooltip = UI.DIV(tooltip.Render()); renderedTooltip.style.display = "block"; renderedTooltip.style.overflow = "hidden"; renderedTooltip.style.textOverflow = "ellipsis"; document.body.appendChild(renderedTooltip); var(element, _) = Stack.GetCorrectItemToApplyStyle(component); if (element.HasOwnProperty("_tippy")) { H5.Script.Write("{0}._tippy.destroy();", element); } if (animation == TooltipAnimation.None) { H5.Script.Write("tippy({0}, { content: {1}, interactive: {2}, placement: {3}, delay: [{4},{5}], appendTo: {6} });", element, renderedTooltip, interactive, placement.ToString(), delayShow, delayHide, appendToBody ? document.body.As <object>() : "parent".As <object>()); } else { H5.Script.Write("tippy({0}, { content: {1}, interactive: {2}, placement: {3}, animation: {4}, delay: [{5},{6}], appendTo: {7} });", element, renderedTooltip, interactive, placement.ToString(), animation.ToString(), delayShow, delayHide, appendToBody ? document.body.As <object>(): "parent".As <object>()); } H5.Script.Write("{0}._tippy.show();", element); //Shows it imediatelly, as the mouse is hovering the element // 2020-10-05 DWR: Sometimes a tooltip will be attached to an element that is removed from the DOM and then the tooltip is left hanging, orphaned. component.WhenRemoved(() => { // 2020-10-05 DWR: I presume that have to check this property before trying to kill it in case it's already been tidied up if (element.HasOwnProperty("_tippy")) { H5.Script.Write("{0}._tippy.destroy();", element); } }); } return(component); }
public static T Tooltip <T>(this T component, string tooltip, TooltipAnimation animation = TooltipAnimation.ShiftAway, TooltipPlacement placement = TooltipPlacement.Top, int delayShow = 0, int delayHide = 0) where T : IComponent { if (string.IsNullOrWhiteSpace(tooltip)) { return(component); } return(component.Tooltip( new Raw(UI.Raw(tooltip)), animation: animation, placement: placement, delayShow: delayShow, delayHide: delayHide )); }
private void TooltipLayout() { //ToolTip TextView tooltipLabel = new TextView(context); tooltipLabel.TextSize = 15; tooltipLabel.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent); tooltipLabel.Text = "Tooltip Placement"; LinearLayout.LayoutParams toollabelParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); toollabelParams.SetMargins(0, 10, 0, 0); //ToolTip Spinner toolTipSpinner = new Spinner(context, SpinnerMode.Dialog); toolTipSpinner.SetGravity(GravityFlags.Left); //Placement List List <String> placementList = new List <String>(); placementList.Add("None"); placementList.Add("TopLeft"); placementList.Add("BottomRight"); //Placement Adapter placementAdapter = new ArrayAdapter <String>(context, Android.Resource.Layout.SimpleSpinnerItem, placementList); placementAdapter.SetDropDownViewResource(Android.Resource.Layout.SimpleSpinnerDropDownItem); //ToolTip Spinner Item Selected Listener toolTipSpinner.ItemSelected += (object sender, AdapterView.ItemSelectedEventArgs e) => { String selectedItem = placementAdapter.GetItem(e.Position); toolTipSpinnerPosition = e.Position; if (selectedItem.Equals("None")) { toolTipPosition = TooltipPlacement.None; } if (selectedItem.Equals("TopLeft")) { toolTipPosition = TooltipPlacement.TopLeft; } if (selectedItem.Equals("BottomRight")) { toolTipPosition = TooltipPlacement.BottomRight; } ApplyChanges(); }; toolTipSpinner.Adapter = placementAdapter; toolTipSpinner.SetSelection(toolTipSpinnerPosition); toolTipSpinner.LayoutParameters = new FrameLayout.LayoutParams((int)(totalWidth * 0.33), ViewGroup.LayoutParams.WrapContent); //toolTipLayout LinearLayout toolTipLayout = new LinearLayout(context); toolTipLayout.Orientation = Android.Widget.Orientation.Horizontal; toolTipLayout.AddView(tooltipLabel); toolTipLayout.AddView(toolTipSpinner); proprtyOptionsLayout.AddView(toolTipLayout); //spaceText TextView spaceText3 = new TextView(context); spaceText3.LayoutParameters = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 40, GravityFlags.Center); proprtyOptionsLayout.AddView(spaceText3); }
public static MvcHtmlString UxTooltipAttributes(this HtmlHelper helper, string text, TooltipPlacement placement = TooltipPlacement.Auto) { var tooltip = new Tooltip(text, placement); return tooltip.ToHtmlString(); }
public Tooltip(string text, TooltipPlacement placement = TooltipPlacement.Auto) { Text = text; Placement = placement; }