-
Notifications
You must be signed in to change notification settings - Fork 233
Open
Copy link
Labels
area-compilerUmbrella for all compiler issuesUmbrella for all compiler issues
Milestone
Description
When defining a reference @ref to a html element or razor component you now need to define it double:
<Component @ref="myComponent">Hello Blazor!</Component>
@code {
private Component myComponent;
void DoSomething() => myComponent.ShowMessage();
}
You now need to define the type and name twice, both in the razor language and in de code block. Making refactoring / code maintenance more difficult when eg the Component is renamed. It would be a great improvement if the reference in the code block doesnt need to defined aswell. But that it's inferred from the razor language.
Same as for example in Wpf. There your can give a Name to a element and then it's available in the code-behind
So the final solution will be then be:
<Component @ref="myComponent">Hello Blazor!</Component>
@code {
void DoSomething() => myComponent.ShowMessage();
}
ramihamati, RyoukoKonpaku, lif-enable, adrianwright109, boukenka and 2 moreCopilot
Metadata
Metadata
Labels
area-compilerUmbrella for all compiler issuesUmbrella for all compiler issues