Search code examples
wpfrouted-events

raising events passing parameters in wpf


I'd like to add tabs to my window when an item in the GridView is double-clicked. But the tab that will be added depends on the clicked item. Which way should I do this on WPF? I thought about RoutedEvents, but I don't know how to pass a parameter with it. Any suggestions?


Solution

  • Use commands rather than routed events:

    Set a command for the clicked item and pass the clicked item's reference as the command's parameter using RelativeSource binding in the XAML.