0

I'm using the MVVM toolkit in a small Blazor application. In a table I've put an "edit" button which calls a ModifyCommand on my ViewModel. A parameter is passed from my View via the CommandParameter.

Now in my command I want to goto another View passing the parameter. I basically want to use the same page for new entries and edits into my table. But I'm struggling to find the proper way to navigate and pass the parameter to my other page.

Note that I'm a bit new to Blazor coming from a WPF background. Maybe I'm just thinking in the wrong way. :-)

Button:

<MudIconButton Icon="@Icons.Material.Filled.Edit" Color="Color.Primary" aria-label="modify" Command="@ViewModel.ModifyCommand" CommandParameter="@context"></MudIconButton>

I'm using MudBlazor components and this button is inside a MudTable. So the @context is my "line" data in the table.

Command:

    [RelayCommand]
public virtual void Modify(MaintenanceWorkerRegistration registration)
{
    //navigate to RegisterIntervention page
}

So in this method I need to navigate to a page with a form. And I need to pass the parameter.

What's the best and correct way to do this?

Tim D'haeyer
  • 584
  • 6
  • 19
  • [Polite] "Maybe I'm just thinking in the wrong way". Quite possibly, but with only a very brief description and no code, it's impossible to say - see https://stackoverflow.com/help/how-to-ask – MrC aka Shaun Curtis Mar 10 '23 at 15:25

0 Answers0