Closed julienGrd closed 4 years ago
We believe this issue is better described by https://github.com/aspnet/AspNetCore/issues/17200. If you are asking for a different thing, feel free to comment here and we will re-evaluate.
I don't really know if we speak about the same thing, i will follow the 17200 and see the evolution
We believe this issue is better described by #17200. If you are asking for a different thing, feel free to comment here and we will re-evaluate.
@javiercn I don't think it's the same thing.
This request is to allow the setting of a parameter like public MySubComponent[] { get; set;}
as child content.
A good example of this would be a Grid<T>
which would have a parameter public Column<T>[] Columns { get; set;}
<Grid Items=People>
<Columns>
<Column Data=@(x => x.FullName)/>
</Columns>
</Grid>
At the moment there is no way for Column<T>
to infer its type from Grid<T>
because RenderFragments can contain absolutely anything.
This is a request from some kind of [ViewChild] and [ViewChildren] attributes which will let the developer specify only one type of content is allowed (a grid has columns, nothing else).
@mrpmorris You can have templated components that use RenderFragment<T>
https://docs.microsoft.com/en-us/aspnet/core/blazor/components?view=aspnetcore-3.0#templated-components
@javiercn that would be a single item. The request is for an array, at the moment it isn't possible to implement the grid/column example I gave using RenderFragment<T>
Here is a good example https://github.com/IvanJosipovic/BlazorTable/blob/master/src/BlazorTable.Sample/Pages/Index.razor#L20
See how every Column has to specify the generic TableItem? In "normal" C# you could infer this from the Table
@javiercn Could you reopen this, please? It's almost certainly not the same thing as the issue you linked to. This is a request for an array of strongly typed content, not render fragments.
Is your feature request related to a problem? Please describe.
This issue follow this one : https://github.com/aspnet/AspNetCore/issues/17092 I don't know how to really describe this, the idea is to allow have array sub component in a component wich was "automatically" typed with the generic parameter of a parent. Its better to read the issue in link to understand the problem
Describe the solution you'd like
The solution of @mrpmorris on this comment seem nice : https://github.com/aspnet/AspNetCore/issues/17092#issuecomment-554653567
thanks !