Reputation: 2814
Is there a way to get a reference to a RoutedEvent given its name?
I tried EventManager.GetRoutedEventsForOwner( typeof(ListBox) ).FirstOrDefault( r => r.Name == eventName )
but it return null
.
Upvotes: 0
Views: 212
Reputation: 169270
The ListBox
class defines no routed events. The Selector
base class does though:
string eventName = "SelectionChanged";
var events = EventManager.GetRoutedEventsForOwner(typeof(System.Windows.Controls.Primitives.Selector)).FirstOrDefault( x=> x.Name == eventName);
Upvotes: 1