|
Hello,
my problem is very simple. I wrote my custom control where I made my own event called DateTapped.
public event EventHandler<SelectionChangedEventArgs> DateTapped;
protected void OnDateTapped(DateTime dateTime) {
if (DateTapped != null) {
DateTapped(this, new SelectionChangedEventArgs(dateTime));
}
if (DateTappedCommand != null)
{ if (DateTappedCommand.CanExecute(dateTime)) { DateTappedCommand.Execute(dateTime);
}
}
}
public ICommand DateTappedCommand { get { return (ICommand)GetValue(DateTappedCommandProperty); } set { SetValue(DateTappedCommandProperty, value); } }
public static readonly DependencyProperty DateTappedCommandProperty = DependencyProperty.Register("DateTappedCommand", typeof(ICommand), typeof(Calendar), new PropertyMetadata(null));
<customCalendar:Calendar cm:Message.Attach="[Event DateTapped] = [Action EventDateClick($eventArgs)]" >
And when i try to bind event to function in ViewModel it doesn't do anything. When i create code in code behind everything it's ok. Could you tell me how to do that in ViewModel in caliburn.micro ?
|