Skip to content

[Blazor] component inheritance, rendering logic in base component #21764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JvanderStad opened this issue May 13, 2020 · 1 comment
Closed

[Blazor] component inheritance, rendering logic in base component #21764

JvanderStad opened this issue May 13, 2020 · 1 comment
Labels
area-blazor Includes: Blazor, Razor Components

Comments

@JvanderStad
Copy link

Follow up issue for #21664

My original issue was resolved with the following comment.

You can use class file (.cs) to inherit from the abstract component class and that way you'll control exactly what you override.

However, I use Razor RenderFragments in the overriden class

eg.

public override void SetupColumns()
{
	this[nameof(OrganizationQueryModel.Id)].RazorTemplate = (OrganizationQueryModel context) =>
	@<div>
		<img class="img-thumbnail circle thumb96 d-inline-block m-0" src="@(LinkGenerator.GetPathByAction<OrganizationController>(x=>x.Picture(context.Id)))" />
	</div>;
}
@mkArtakMSFT mkArtakMSFT added the area-blazor Includes: Blazor, Razor Components label May 13, 2020
@mkArtakMSFT
Copy link
Contributor

Thanks for the follow-up, @JvanderStad.
Reopening the original issue to continue the conversation in there for a better context.

@ghost ghost locked as resolved and limited conversation to collaborators Jun 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-blazor Includes: Blazor, Razor Components
Projects
None yet
Development

No branches or pull requests

2 participants