C# can';t将值从宿主活动传递到MvxCommand
我试图将两个值传递给MvxCommand,如下代码所示。第一个值的类型为string,后一个为Enum。 但我得到了以下错误:C# can';t将值从宿主活动传递到MvxCommand,c#,visual-studio,xamarin,icommand,C#,Visual Studio,Xamarin,Icommand,我试图将两个值传递给MvxCommand,如下代码所示。第一个值的类型为string,后一个为Enum。 但我得到了以下错误: the non-generic type MvxCommand can’t be used with type arguments 请让我知道如何修复此错误 代码: //in View „Activity" ViewModel. DexCommand.Execute(result, value); //in ViewM
the non-generic type MvxCommand can’t be used with type arguments
请让我知道如何修复此错误
代码:
//in View „Activity"
ViewModel. DexCommand.Execute(result, value);
//in ViewModel
public IMvxCommand DexCommand => new MvxCommand<string, VRTEnum>((res, val) =>
{
});
//在“活动”视图中
ViewModel.DexCommand.Execute(结果、值);
//在视图模型中
公共IMvxCommand DexCommand=>new MvxCommand((res,val)=>
{
});
非泛型类型MvxCommand不能与类型参数一起使用
以下是源代码片段:
namespace MvvmCross.Commands
{
public interface IMvxCommand : ICommand
{
void RaiseCanExecuteChanged();
void Execute();
bool CanExecute();
}
public interface IMvxCommand<T> : ICommand
{
[Obsolete("Use the strongly typed version of Execute instead", true)]
new void Execute(object parameter);
[Obsolete("Use the strongly typed version of CanExecute instead", true)]
new bool CanExecute(object parameter);
void RaiseCanExecuteChanged();
void Execute(T parameter);
bool CanExecute(T parameter);
}
}
new MvxCommand<Tuple<string, VRTEnum>>(Action);