I have a usercontrol with a custom routed event:
public partial class DummyControl : UserControl
{
public static readonly RoutedEvent ActionClickEvent = EventManager.RegisterRoutedEvent(
"ActionClick",
RoutingStrategy.Bubble,
typeof(RoutedEventHandler),
typeof(DummyControl));
public event RoutedEventHandler ActionClick
{
add { this.AddHandler(ActionClickEvent, value); }
remove { this.RemoveHandler(ActionClickEvent, value); }
}
public DummyControl()
{
this.InitializeComponent();
}
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
this.RaiseEvent(new RoutedEventArgs(ActionClickEvent,this));
}
}
In my xaml I'm using a datagrid and I want to pass the SlectedItem to my ViewModel. But when the event gets triggered, the passed item is alway null. When trying the same with an button everything works fine.
<Cstm:DummyControl cal:Message.Attach="[Event ActionClick] = [Action Test(dataGrid.SelectedItem)]"/>
Don't know if this is a known bug or if I missed something. :\