Custom control events bug?

Topics: Bugs
Jan 26, 2013 at 9:03 PM
Edited Jan 26, 2013 at 9:05 PM

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 ? 

Jan 27, 2013 at 4:44 AM

since its a custom control you might need to create a convention for it.

Jan 27, 2013 at 8:50 PM

But how? I'm searching for solution for two days and still no idea. Could you help me?

Jan 28, 2013 at 7:55 AM

And other bindings with the ViewModel are working?

Maybe you can create a sample to show your issue, as at the moment we can only guess.