Adds support for 'Context' parameters on components
This change allows you to set the parameter name of a parameterized child content by using the `Context` attribute on the component. The `Context` attribute will be defined (and shown by completion) when the component has one or more declared parameterized (`RenderFragment<>`) child content parameters.
This is nice for cases where you are using implicit child content:
```
<ol>
<Repeater Items="People" Context="person">
<li>@person.FirstName</li>
</Repeater>
</ol>
```
or, when you have multiple child content elements and want them all to have the same parameter name:
```
<MyComponent Items="People" Context="person">
<ChildContent1><div>@person.FirstName</div></ChildContent1>
<ChildContent2><div>@person.LastName</div></ChildContent2>
</Repeater>
```
The parameter name can be overridden by using the `Context` parameter on the child content element:
```
<MyComponent Items="People" Context="person">
<ChildContent1 Context="item"><div>@item.FirstName</div></ChildContent1>
<ChildContent2><div>@person.LastName</div></ChildContent2>
</Repeater>
```
If the component defines a `Context` parameter already then we won't synthesize one - your component's parameter will work exactly as it did before this feature.
|
||
|---|---|---|
| .. | ||
| Razor | ||
| TestFiles | ||
| BindRazorIntegrationTest.cs | ||
| BootJsonWriterTest.cs | ||
| ChildContentRazorIntegrationTest.cs | ||
| CodeGenerationTestBase.cs | ||
| ComponentDiscoveryRazorIntegrationTest.cs | ||
| ComponentRenderingRazorIntegrationTest.cs | ||
| DeclarationRazorIntegrationTest.cs | ||
| DesignTimeCodeGenerationTest.cs | ||
| DiagnosticRazorIntegrationTest.cs | ||
| DirectiveRazorIntegrationTest.cs | ||
| FilePathRazorIntegrationTest.cs | ||
| GenericComponentRazorIntegrationTest.cs | ||
| Microsoft.AspNetCore.Blazor.Build.Test.csproj | ||
| RazorBaselineIntegrationTestBase.cs | ||
| RazorIntegrationTestBase.cs | ||
| RenderingRazorIntegrationTest.cs | ||
| RuntimeCodeGenerationTest.cs | ||
| RuntimeDependenciesResolverTest.cs | ||
| TemplateRazorIntegrationTest.cs | ||
| TypingTest.cs | ||
| WorkingDirectoryRazorIntegrationTest.cs | ||