我正在尝试遵循 mvvm 模式。使用 galasoft EventToCommand 时出现以下错误:“GalaSoft.MvvmLight.Command.RelayCommand.RelayCommand(System.Action)”的最佳重载方法匹配有一些无效参数...
我的 XAML 中的代码:
<toolkit:DatePicker Header="Select Date"
ValueStringFormat="{}{0:D}"
HorizontalAlignment="Left" Margin="0,126,0,0"
Name="datePicker1"
VerticalAlignment="Top" FontFamily="Verdana"
FontSize="22" Width="450">
<i:Interaction.Triggers>
<i:EventTrigger EventName="ValueChanged">
<cmd:EventToCommand PassEventArgsToCommand="True"
Command="{Binding DateSelection}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</toolkit:DatePicker>
在模型视图中:
public MainViewModel()
{
DateSelection = new RelayCommand<DateTimeValueChangedEventArgs>(time_Call);
}
public RelayCommand<DateTimeValueChangedEventArgs> DateSelection
{
get;
set;
}
void time_Call(object sender, DateTimeValueChangedEventArgs e)
{
}
我是空白!