How to setup Tooltip only on Textbox Icon hover

Hi,

I would like to know if I can setup a tooltip to show only when hovered against a textbox icon? I was able to generate the tooltip when I hover over the Icon but it also shows when I hover on the textbox. Please see the code below I have used to implement this.

<SfTooltip ID="Tooltip" @ref="sttMobile" Content="@Value" Position="Position.BottomRight"> <SfTextBox @ref="sftPrefferredContactIconMobile" ID="Mobile" @bind-Value="@User.Mobile" Created="@PrefferedContactIconForMobile">
</SfTextBox>
</SfTooltip>

@code{
SfTextBox sftPrefferredContactIconMobile;
SfTooltip sttMobile;


private string Value { get; set; } = default!;

public async Task PrefferedContactIconForMobile()
{
var touchHover = EventCallback.Factory.Create<MouseEventArgs>(this, touchIconMouseHover);
await sftPrefferredContactIconMobile.AddIcon("append", "e-icons e-radio-button", new Dictionary<string, object>() { { "onmouseover", touchHover }});
}


public void touchIconMouseHover()
        {
            Value = "Preferred method of contact";
        }
}

Screenshot 2022-01-20 170555.png



3 Replies 1 reply marked as answer

VJ Vinitha Jeyakumar Syncfusion Team January 21, 2022 02:00 PM UTC

Hi Harryi,


You can use the Target property of the Tooltip control to specify the target element. please check the code below,

Code snippet:
<SfTooltip OnOpen="open" Target=".e-icons.e-radio-button"  ID="Tooltip" @ref="sttMobile" Content="Showing tooltip" Position="Position.BottomRight">
    <SfTextBox @ref="sftPrefferredContactIconMobile" ID="Mobile"  Created="@PrefferedContactIconForMobile">
    </SfTextBox>
</SfTooltip>


Regards,
Vinitha


Marked as answer

HA Harryi replied to Vinitha Jeyakumar January 24, 2022 01:29 AM UTC

Woah, worked like a charm. Thanks a bunch!



SP Sureshkumar P Syncfusion Team January 24, 2022 05:16 AM UTC

Hi Harryi, 
 
Thanks for your update. 
 
Regards, 
Sureshkumar P 


Loader.
Up arrow icon