Class TooltipService
Class TooltipService. Contains various methods with options to open and close tooltips.
Should be added as scoped service in the application services and RadzenTooltip should be added in application main layout.
Implements the
Inheritance
System.Object
TooltipService
Namespace: Radzen
Assembly: Radzen.Blazor.dll
Syntax
public class TooltipService : IDisposable
Examples
@inject TooltipService tooltipService
<RadzenButton Text="Show tooltip" MouseEnter="@(args => ShowTooltipWithHtml(args, new TooltipOptions(){ Style = "color:#000", Duration = null }))" />
@code {
void ShowTooltipWithHtml(ElementReference elementReference, TooltipOptions options = null) => tooltipService.Open(elementReference, ds =>
@<div>
Some<b>HTML</b> content
</div>, options);
}
}
Constructors
TooltipService(NavigationManager)
Initializes a new instance of the TooltipService class.
Declaration
public TooltipService(NavigationManager uriHelper)
Parameters
Type | Name | Description |
---|---|---|
NavigationManager | uriHelper | The URI helper. |
Methods
Close()
Closes this instance.
Declaration
public void Close()
Dispose()
Disposes this instance.
Declaration
public void Dispose()
Open(ElementReference, RenderFragment<TooltipService>, TooltipOptions)
Opens the specified element.
Declaration
public void Open(ElementReference element, RenderFragment<TooltipService> childContent, TooltipOptions o = null)
Parameters
Type | Name | Description |
---|---|---|
ElementReference | element | The element. |
RenderFragment<TooltipService> | childContent | Content of the child. |
TooltipOptions | o | The o. |
Open(ElementReference, String, TooltipOptions)
Opens the specified element.
Declaration
public void Open(ElementReference element, string text, TooltipOptions o = null)
Parameters
Type | Name | Description |
---|---|---|
ElementReference | element | The element. |
System.String | text | The text. |
TooltipOptions | o | The o. |
Events
OnClose
Raises the Close event.
Declaration
public event Action OnClose
Event Type
Type | Description |
---|---|
Action |
OnNavigate
Occurs when [on navigate].
Declaration
public event Action OnNavigate
Event Type
Type | Description |
---|---|
Action |
OnOpen
Occurs when [on open].
Declaration
public event Action<ElementReference, Type, TooltipOptions> OnOpen
Event Type
Type | Description |
---|---|
Action<ElementReference, Type, TooltipOptions> |