Adds dual EventCallback parameter aliases (bare and On-prefixed) to Blazor components for Web Forms migration compatibility. Guides creation of EventArgs classes, coalescing invocation patterns, and HasDelegate guard checks. Use when adding new event parameters to a BWFC component, implementing Web Forms event naming conventions, or migrating ASP.NET Web Forms event handlers to Blazor.
100
100%
Does it follow best practices?
Impact
100%
1.88xAverage score across 3 eval scenarios
Passed
No known issues
When adding new EventCallback parameters to a Blazor component that emulates a Web Forms control. Every event needs BOTH a bare name (ItemCommand) and an On-prefix (OnItemCommand) as independent [Parameter] auto-properties.
src/BlazorWebFormsComponents/{ControlName}{EventName}EventArgs.csBlazorWebFormsComponentsSystem.EventArgspublic object Sender { get; set; } for BWFC conventionGridViewRowEventArgs, DataListCommandEventArgs, RepeaterItemEventArgs/// <summary>
/// Occurs when {description}.
/// </summary>
[Parameter]
public EventCallback<MyEventArgs> EventName { get; set; }
/// <summary>
/// Web Forms migration alias for EventName.
/// </summary>
[Parameter]
public EventCallback<MyEventArgs> OnEventName { get; set; }Critical: BOTH must be independent auto-properties. Never delegate one to the other.
var handler = EventName.HasDelegate ? EventName : OnEventName;
await handler.InvokeAsync(args);If the component uses .HasDelegate to conditionally render UI:
bool ShowSomething => EventName.HasDelegate || OnEventName.HasDelegate;If the component already has an internal method with the same name as the new parameter (e.g., DataList had a ItemDataBound() method), rename the method to {Name}Internal(). Never rename the parameter — it must match Web Forms markup.
If another component directly accesses the EventCallback property (e.g., ButtonField accessing GridView.OnRowCommand), update it to coalesce both names.
Web Forms distinguishes -ing (before) from -ed (after) events with different EventArgs types:
FormViewInsertEventArgs → for ItemInserting (present/before)FormViewInsertedEventArgs → for ItemInserted (past/after)Don't mix them up. The -ed version typically has AffectedRows, Exception, ExceptionHandled.
GridView.razor.cs — comprehensive example with 10+ event pairsFormView.razor.cs — CRUD events with bare + On-prefix aliasesDataList.razor.cs — method-rename pattern (ItemDataBoundInternal).ai-team/skills/blazor-parameter-aliases/SKILL.md — general alias pattern1bd9b17
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.