Aspnetcore.docs: Capture references to components

Created on 19 Sep 2019  ยท  5Comments  ยท  Source: dotnet/AspNetCore.Docs

I'm trying to capture the component and Show or Hide him on @onmouseover, but it gives me an error of:
Error CS0029 Cannot implicitly convert type 'Microsoft.AspNetCore.Components.ElementReference' to '%ComponentName%'. And it's not reconizing the Show method.
Meaning, the compiler is seeing the Component as 'Microsoft.AspNetCore.Components.ElementReference' which doesn't have a Show method.

Am i doing something wrong?


Document Details

โš  Do not edit this section. It is required for docs.microsoft.com โžŸ GitHub issue linking.

Blazor Source - Docs.ms

All 5 comments

@caiohoffmann Provide more info: Show the component. What's its name (file name)? Where is it in the app (what folder)? What SDK are you on (dotnet --version)? What version of VS? FYI: We're all ๐Ÿƒ๐Ÿƒ๐Ÿ˜…๐Ÿƒ right now on 3.0 updates. Your best bet for a fast answer is probably to open an issue on Stack Overflow or a support chat, such as Slack or Gitter.

[EDIT by guardrex to fix code block]

In my TaskBlock.razor:

<BlockMenu @ref="Menu" />

@code {
    private MenuBlock Menu;

    private void ShowMenu()
    {
        Menu.Show();
    }
}

I'll open an issue on StackOverflow either way!

Did you mean ...

private BlockMenu Menu;

Yes!

Thanks, sorry for that!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aaron-bozit picture aaron-bozit  ยท  3Comments

Rick-Anderson picture Rick-Anderson  ยท  3Comments

Raghumu picture Raghumu  ยท  3Comments

YeyoCoder picture YeyoCoder  ยท  3Comments

sonichanxiao picture sonichanxiao  ยท  3Comments