Get Started
Install
From NuGet:
dotnet add package FlexCore
Or as a project reference (during development):
<ProjectReference Include="..\path\to\FlexCore\FlexCore.csproj" />
License
The FlexCore package on NuGet is released under the MIT license. A Community edition is in preparation and will be delivered as a download link by email; sign up to receive it or to ask a question.
Register services
In Program.cs. These are the registrations this site uses (Program.cs in the Showcase repository):
using Fx.ControlKit.Dialogs;
using Fx.ControlKit.Notifications;
builder.Services.AddScoped<NotificationService>(); // toasts
builder.Services.AddScoped<DialogService>(); // confirm / alert / prompt
builder.Services.AddScoped<IDialogService>(sp => sp.GetRequiredService<DialogService>());
builder.Services.AddScoped<Fx.ControlKit.ZoomService>(); // optional: text zoom shared by the controls; the hosts work without it
// Report writer only: ReportOptions, CrystalXmlReportLoader and your own IReportDataExecutor,
// IReportSessionContext, IReportExporter, IReportPickListProvider and IReportViewerSettings
// (the Showcase Program.cs has a working set with stub adapters).Mount the hosts
Toasts and service dialogs render through two host components. Put them once in your layout, or nothing will appear when you call
NotificationService or IDialogService. In MainLayout.razor:
@using Fx.ControlKit.Dialogs
@using Fx.ControlKit.Notifications
<main>@Body</main>
<NotificationDisplayControl />
<DialogHostControl />
Controls load their own scripts and styles; there is nothing to add to App.razor beyond the usual Blazor script tag.
Use a control
In a Razor page or layout:
@using Fx.ControlKit.Grid
<GridControl TValue="MyRow" DataSource="@rows"
AllowSelection="true" AllowSorting="true"
AllowFiltering="true" AllowGrouping="true">
<GridColumnsBase>
<GridColumn Field="Id" HeaderText="ID" Width="80px" />
<GridColumn Field="Name" HeaderText="Name" Width="200px" />
<GridColumn Field="Quantity" HeaderText="Qty" Width="100px"
Type="ColumnType.Number" Format="N0" TextAlign="TextAlign.Right" />
</GridColumnsBase>
</GridControl>Targets
- .NET 10.0
- Blazor Server or Blazor WebAssembly