'How to send a parameter from one component to another in blazor?

I have a question. I know how to send parameters from one component to another through url, but how could I send a parameter through one method and receive it in another?

in my first component I have the following button that executes a method in which I have a property of type bool, that property is the one that I want to send to another component

<button class="btn btn-primary" @onclick="ClickCallback">Enviar Parametro</button>

@code{
  public bool Filtro = false;

    void ClickCallback()
    {
        Filtro = true;
        Console.WriteLine(Filtro);
    }
}

and in my second component I want to receive it in this way to later use it:

[Parameter]
    public bool Filtro{ get; set; }

but I don't know how to send and receive it, I repeat I know how to pass that bool by url but I would like to pass it inside a method executed by means of a button, any suggestion? I don't know if using eventcallback I could do



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source