Hello,
Can you please let me know how could I define and implement above mentioned command in viewmodel interface/class.
You can do this by changing the value of CommandParameter, you can set the reference for your datapicker's x:Name
and set the path to the DatePicker's Date property.
<DatePicker
x:Name="dtDatepicker"
>
<DatePicker.Behaviors>
<toolkit:EventToCommandBehavior
EventName="DateSelected"
Command="{Binding FromDateSelectedCommand}"
CommandParameter="{Binding Source={x:Reference dtDatepicker},
Path=Date}"
/>
</DatePicker.Behaviors>
</DatePicker>
After that, you can get the value in the FromDateSelected method of ViewModel, I changed the type of date to object
.
[RelayCommand]
public void FromDateSelected(object date)
{
var res = date;
}
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.