Guidance for creating Blazor components that emulate ASP.NET Web Forms controls. Use this when implementing new components or extending existing ones in the BlazorWebFormsComponents library.
This skill covers creating new Blazor components that emulate ASP.NET Web Forms controls.
System.Web.UI.WebControlssrc/BlazorWebFormsComponents/{ComponentName}.razorsrc/BlazorWebFormsComponents/{ComponentName}.razor.csBaseWebFormsComponent - Basic componentsBaseStyledComponent - Components with stylingDataBoundComponent<T> - Data-bound componentssrc/BlazorWebFormsComponents.Test/{ComponentName}/samples/AfterBlazorServerSide/Components/Pages/ControlSamples/{ComponentName}/samples/AfterBlazorServerSide.Tests/docs/{Category}/{ComponentName}.mdsamples/AfterBlazorServerSide/Components/Layout/NavMenu.razor (TreeView)samples/AfterBlazorServerSide/Components/Pages/ComponentList.razor (home page catalog)mkdocs.yml and README.md| Base Class | Use When |
|------------|----------|
| BaseWebFormsComponent | Simple components without styling (Literal, PlaceHolder) |
| BaseStyledComponent | Components with visual styling (Label, Panel, Button) |
| ButtonBaseComponent | Button-like components (Button, LinkButton, ImageButton) |
| DataBoundComponent<T> | Components binding to collections (Repeater, GridView) |
| BaseValidator | Validation controls |
Match Web Forms property names exactly:
Text not Label or ContentCssClass not Class or ClassNameNavigateUrl not Href or UrlImageUrl not Src or SourcePrefix with On:
OnClick for click eventsOnCommand for command eventsOnSelectedIndexChanged for selection changesOnDataBinding for data binding eventsEvery component must have integration tests in samples/AfterBlazorServerSide.Tests/ using Playwright:
Page load test in ControlSampleTests.cs:
[Theory] test (EditorControl, DataControl, etc.)Interactive test in InteractiveComponentTests.cs (for interactive components):
Example page load test entry:
[Theory]
[InlineData("/ControlSamples/YourComponent")]
public async Task EditorControl_Loads_WithoutErrors(string path)
Example interactive test:
[Fact]
public async Task YourComponent_Interaction_Works()
{
var page = await _fixture.NewPageAsync();
try
{
await page.GotoAsync($"{_fixture.BaseUrl}/ControlSamples/YourComponent");
// Test interactions...
// Assert expected behavior...
}
finally
{
await page.CloseAsync();
}
}
Run integration tests with:
dotnet test samples/AfterBlazorServerSide.Tests
npx skills add FritzAndFriends/component-development下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer