BlazorWebFormsComponents icon indicating copy to clipboard operation
BlazorWebFormsComponents copied to clipboard

DataList: Simplify TableItemStyle elements

Open csharpfritz opened this issue 5 years ago • 4 comments

HeaderStyle, ItemStyle, etc parameter elements should not need a ChildContents container to be represented.

csharpfritz avatar Jan 20 '20 04:01 csharpfritz

Currently the Markup needs

<DataList @ref="simpleDataList"
	  runat="server"
	  EnableViewState="false"
	  Context="Item"
	  ItemType="SharedSampleObjects.Models.Widget">
	<ChildContent>
		<BlazorWebFormsComponents.HeaderStyle BackColor="Blue" ForeColor="White"></BlazorWebFormsComponents.HeaderStyle>
	</ChildContent>
	<HeaderTemplate>Simple Widgets</HeaderTemplate>
	<ItemTemplate>@Item.Id</ItemTemplate>
</DataList>

We would like to remove the need for the <ChildContent> tag

<ChildContent>
    <BlazorWebFormsComponents.HeaderStyle BackColor="Blue" ForeColor="White"></BlazorWebFormsComponents.HeaderStyle>
</ChildContent>

and be able to use the HeaderStyle using the following more compatible format

<DataList @ref="simpleDataList"
	  runat="server"
	  EnableViewState="false"
	  Context="Item"
	  ItemType="SharedSampleObjects.Models.Widget">
	<HeaderStyle BackColor="Blue" ForeColor="White"></HeaderStyle>
	<HeaderTemplate>Simple Widgets</HeaderTemplate>
	<ItemTemplate>@Item.Id</ItemTemplate>
</DataList>

grleachman avatar Feb 11 '20 11:02 grleachman

Correct.. how could we support a child element with attributes?

csharpfritz avatar Feb 11 '20 11:02 csharpfritz

DevNotes Blazor team commit for error message on Templated Components and test

I suspect this is another by design feature

Note the comment

Thanks for your feedback, @Venkat4655. We'll keep this in mind and will observe how the rest of the community reacts to the current design choice we've made. If we hear a lot of feedback similar to your, we will reconsider our approach. --

Link #1

grleachman avatar Feb 11 '20 23:02 grleachman

Any updates on this?

hishamco avatar Aug 29 '20 21:08 hishamco