A Razor UI component that wraps content and shows a shared tooltip when the mouse is over the component. It stores a Content fragment and a Tooltip fragment, and on mouse over sets the global RazorTooltipSystem.Hovering to itself and calls RazorTooltipSystem.Show(Tooltip).
@using System;
@using Sandbox;
@using Sandbox.UI;
@using Sandbox.Razor;
<root>
@Content
</root>
@code
{
public RenderFragment Content { get; set; }
public new RenderFragment Tooltip { get; set; }
protected override void OnMouseOver(MousePanelEvent e)
{
base.OnMouseOver(e);
if ( RazorTooltipSystem.Hovering != this )
{
RazorTooltipSystem.Hovering = this;
RazorTooltipSystem.Show( Tooltip );
}
}
// protected override void OnMouseOut(MousePanelEvent e)
// {
// base.OnMouseOut(e);
// if ( RazorTooltipSystem.Hovering == this )
// {
// RazorTooltipSystem.Hide( CustomId );
// RazorTooltipSystem.Hovering = null;
// }
// }
}