The dialogue service has a very good feature that allows us to define parameters as a dictionary when calling it to open a page.
This is a sample code:
await DialogService.OpenAsync<DialogCardPage>($"Order {orderID}",
new Dictionary<string, object>() { { "OrderID", orderID } },
new DialogOptions()
{
Resizable = true,
Draggable = true,
Resize = OnResize,
Drag = OnDrag,
Width = Settings != null ? Settings.Width : "700px",
Height = Settings != null ? Settings.Height : "512px",
Left = Settings != null ? Settings.Left : null,
Top = Settings != null ? Settings.Top : null
});
await SaveStateAsync();
}
in this example, the DialogCardPage
is opened in the dialogue and its OrderID parameter set to a value.
Is there any way that I can do this with the layout and menu? I want to be able to have a layout that has menu items and in each menu item, I can set a dictionary which will be used to set the page parameters when opening the page in the body section of the layout.