EventCommander Mappings to bubled events

Jun 22, 2010 at 3:26 PM

Hi Mark,

I'm trying you helpers library and I'd like to bind command to an event fired by Item in ItemsControl (in my scenario TreeViewItem.Expanded). Can I use the EventCommander markup? Something like the next sample - expanded event on TreeViewItem would take it's DataContext and pass it as a parameter to Command bounded on TreeView:

        <julmar:CommandEvent Event="Expander.Expanded" 
            Command="{Binding DirectoryLoadCommand}"
            CommandParameter="{Binding Path=DataContext, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type TreeView}}}" />


Dec 23, 2010 at 3:32 PM


EventCommander was only looking at regular .NET events - not routed events that are attached.  Try the latest release (4.02) and see if it solves your issue.  If EventCommander cannot find a .NET event on the target object, then it looks for a RoutedEvent registered with the specified name (Type.RoutedEventName) and, if the target is a FrameworkElement, uses AddHandler to register to it.