EasyTipView icon indicating copy to clipboard operation
EasyTipView copied to clipboard

Use in Xamarin Forms

Open wanderson-ra opened this issue 6 years ago • 5 comments

Is there any way to use in Xamarin Forms with custom renderers? If so can you give me a hand?

wanderson-ra avatar Apr 24 '18 11:04 wanderson-ra

Hey, that's an interesting request. I think it's possible via custom renderer. However you will want to have a similar widget available for Android at least (I imagine). This binding library would be a good candidate.

nmilcoff avatar May 04 '18 19:05 nmilcoff

I was able to create a render with your library, it worked well for Xamarin Forms IOS. I'm going to share the renderer I created, maybe we can improve it. I created it based on a specific control, but I would like to do a global renderer or effect.

In Xamarin Forms Android I'm trying to make an implementation with the library you mentioned, but still unsuccessful in positioning the Tooltip on the screen.

using System.ComponentModel;
using Plugin.Iconize;
using Tradutor.Libras.Mobile.Core.Controls;
using Tradutor.Libras.Mobile.iOS.Controls;
using Xamarin.Forms;

[assembly: ExportRenderer(typeof(TooltipLayout), typeof(TooltipLayoutRenderer))]
namespace Tradutor.Libras.Mobile.iOS.Controls
{
    public class TooltipLayoutRenderer : IconImageRenderer
    {
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (Element == null)
                return;

            if (Control == null)
                return;

            if (e.PropertyName != TooltipLayout.EnableTooltipProperty.PropertyName) return;

            var tooltipLayout = (TooltipLayout)Element;

            if (!tooltipLayout.EnableTooltip) return;

             var etv = new EasyTipView.EasyTipView
            {
                Text = new Foundation.NSString("This is a tooltip sample!"),
                ArrowPosition = EasyTipView.ArrowPosition.Left,
                BorderColor = UIColor.White,
                BubbleColor = UIColor.FromRGB(156, 39, 176),
                ForegroundColor = UIColor.White,
                BorderWidth = 3,
                DismissTransform = CGAffineTransform.MakeTranslation(0, -15),
                ShowInitialTransform = CGAffineTransform.MakeTranslation(0, -15),
                ShowInitialAlpha = 0f,
                ShowDuration = 1.5f,
                DismissDuration = 1.5f
            };

            etv.DidDismiss += (o, args) =>
            {
                ((TooltipLayout) Element).EnableTooltip = false;
            };

            etv.Show(Control, Control.Superview.Superview, true);
        }
    }
}

wanderson-ra avatar May 04 '18 19:05 wanderson-ra

Can you also add your code for TooltipLayout?

kunaldhande avatar Jun 05 '18 15:06 kunaldhande

Just in case here there is a blog post where you have the implementation on Xamarin.Forms using Effects for Android & iOS with this library and the binding library pointed out by @nmilcoff

xamboy.com/2019/03/01/showing-tooltips-in-xamarin-forms/

HIH someone 😄

fedemkr avatar Sep 04 '19 17:09 fedemkr

I am Using EasyTipView in my IOS application but that is not working , but in android that is working fine (ToolTipView)

I concern about what parameter should be in first and second parameter in the show method.

now first parameter Image view where I used tooltip but in second parameter what view I should to pass

View Page :

ToolTips1

Code:

ToolTipsCode1

vc.view

VCView

Faizan-Grafi1 avatar Aug 25 '22 13:08 Faizan-Grafi1