Skip to content

Templated generic blazor component does not accept template context RenderFragment<T> for different type T #18310

@awajan

Description

@awajan

When you try to compose and consume a generic (typed) blazor component and expose a RanderFragment parameter, T is being restricted to be the same generic type of the component. Otherwise, the consuming component would show the below error when placing the template markup.

Example: <Component1> is a typed component with type T1, exposing a parameter named Header for example, that is RenderFragmanet<T2>

Now, in Component2 if you try to consume Component1 as below:

<Component1>
  <Header></Header>
</Component1>

The below error would show:

The type or namespace 'T2' does not exist in the namespace '__Blazor....'.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions