I\'m trying to use caliburn micro message to trigger an attached event that I created:
public static class DataChanging
{
public delegate void DataChang
Have you tried this?
cal:Message.Attach="[Event Changing] = [Action SelectedDataChanged($eventArgs)]"
I needed to send an event from a child control to the parents ViewModel, and it worked fine for me. I'll post some example code maybe it'll help someone out!
Child Control codebehind:
public partial class MyControl : UserControl
{
public MyControl()
{
InitializeComponent();
}
#region Routed Events
public static readonly RoutedEvent ControlClosedEvent = EventManager.RegisterRoutedEvent(
"ControlClosed",
RoutingStrategy.Bubble,
typeof(RoutedEventHandler),
typeof(MyControl));
public event RoutedEventHandler ControlClosed
{
add { AddHandler(ControlClosedEvent, value); }
remove { RemoveHandler(ControlClosedEvent, value); }
}
#endregion Routed Events
private void Close(object sender, RoutedEventArgs e)
{
var rea = new RoutedEventArgs(ControlClosedEvent);
RaiseEvent(rea);
}
}
Child control XAML:
Parent view: