RfDoubleClick
is a Blazor component that detects double-click events seperate from single-clicks.
It allows you to easily handle single and double-click interactions from the same element in your Blazor applications.
An easy way to capture double click events.
RfDoubleClick
is a Blazor component that detects double-click events seperate from single-clicks.
It allows you to easily handle single and double-click interactions from the same element in your Blazor applications.
RfDoubleClick
creates an element based on RfDoubleClick.Element
. It supports the following parameters:
OnDoubleClick
: Event callback for double-click events.OnSingleClick
: Event callback for single-click events.Element
: The HTML element to render (default is "button").ClickDelay
: The delay in milliseconds to distinguish between single and double clicks. (default is 400)RfDoubleClick
makes uses of onclick event exclusively for double-click detection over the use of ondblclick.
This should add better support for touch devices and other platforms that may not support the ondblclick event properly.
<RfDoubleClick OnSingleClick="@OnSingleClick"
OnDoubleClick="@OnDoubleClick"
Element="button"
class="button is-primary">
Click or Double Click Me
</RfDoubleClick>
<p>@message</p>
@code {
private string message = "Try single or double clicking the button above.";
private void OnSingleClick()
{
message = "Single click detected!";
}
private void OnDoubleClick()
{
message = "Double click detected!";
}
}
Setting up RForge is simple. Follow the below steps to add RForge Blazor components to your project.
RForge Blazor components are installed via Nuget. There are two packages. One for the blazor app and one for the library if any.
dotnet add package RForge.Blazor
Install-Package RForge.Blazor
This is optional but may be useful if you want to use common enums across the backend and frontend.
dotnet add package RForge.Abstractions
Install-Package RForge.Abstractions
To simplify namespacing while using RForge,
the package is designed with most all components sitting within the root RForge
namespace.
You may want to include the following namespaces in your _import.razor
for ease of use.
@using RForgeBlazor
@using RForgeBlazor.Services
@using RForge.Abstractions
Namespace | Purpose |
---|---|
RForgeBlaozr |
Houses all of the blazor components. |
RForgeBlaozr.Services |
Houses interfaces you may need to communicate with certain components. |
RForgeBlaozr.Abstractions |
Common enums used through out the components. |
In order for some components to work they must first have their services registered.
Open up Program.cs
and add the following line before the var app = builder.Build();
.
using RForgeBlazor;
//...
builder.Services.AddRfForgeBlazorServices();
//...
var app = builder.Build();
RForge makes use of Bulma CSS to stylize the components. Add / install Bulma and add the CSS file to the head. Link to download: Bulma releases.