EasyTipView
EasyTipView copied to clipboard
Use in Xamarin Forms
Is there any way to use in Xamarin Forms with custom renderers? If so can you give me a hand?
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.
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);
}
}
}
Can you also add your code for TooltipLayout?
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 😄
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 :
Code:
vc.view