How do I correct the error "No constructor for type 'Int32' has 1 parameters." that I received from a maui xaml file?

2 weeks ago 13
ARTICLE AD BOX

I'm trying to pass an actual integer value to a method in a view model like this:

<MenuFlyoutItem Text="{Binding SmallDur}" Command="{Binding SetDurationsCommand}" CommandParameter="{x:Int32 1}"/>

And I have registered the view model in the MauiProgram.cs file like this:

builder.Services.AddTransient<MainViewModel>(); But I still keep getting the error message:

No constructor for type 'Int32' has 1 parameters.

Is there any way I can pass an integer value to a view model method without getting an error?

Thanks.

Read Entire Article