How can I add the Click routed event to my custom class?
This doesn't work. When I click the item the Click event does't occur.
public static readonly RoutedEvent ClickEvent = ButtonBase.ClickEvent.AddOwner(typeof(HistoryListBoxItem));
public event RoutedEventHandler Click
{
add { AddHandler(ClickEvent, value); }
remove { RemoveHandler(ClickEvent, value); }
}
Any idea?
Your control needs to raise the event, if you do not do that nothing happens. If you want the whole control to be clickable wrap everything in a button and "forward" its click event.