Hi,
I created an InfoButton component to display tooltips. I have a problem with the positioning of the tooltip. In this case I use it inside a RadzenFormField.
How can I solve it?
thanks
Component InfoButton
<RadzenButton @ref="_bttonRef"
Icon="info"
Variant="Variant.Text"
ButtonStyle="ButtonStyle.Base"
Size="ButtonSize.ExtraSmall"
Style="width: min-content;"
MouseEnter="ShowTooltip" />
@code
{
[Parameter]
public RenderFragment ChildContent { get; set; } = default!;
[Parameter]
public string Text { get; set; } = default!;
private RadzenButton _bttonRef = default!;
private void ShowTooltip(ElementReference elementReference)
{
if (ChildContent != null)
{
TooltipService.Open(elementReference, ds => @ChildContent, null);
}
else if (!string.IsNullOrEmpty(Text))
{
TooltipService.Open(_bttonRef.Element, Text, null);
}
}
}
Usage component InfoButton
<RadzenFormField Text="@L["Cron Shedule"]" AllowFloatingLabel="false" Style="width:100%;">
<ChildContent>
<RadzenTextBox Name="@_id"
@bind-Value="@CronExpression"
@bind-Value:after="Update" />
</ChildContent>
<End>
<InfoButton>
@L["Descriptor:"] - @Descriptor
<br />
@L["Next Occurrence"] - @NextOccurrence
</InfoButton>
</End>
</RadzenFormField>
Result