General Question about Relay Command & Event Handlers with WPF Controls

605
0
10-22-2020 10:16 AM
SeanTabin
New Contributor II

Hi GeoNet Community,

I'm continuing to learn and implement the MVVM for various add-in projects and would like know best practices for accessing event handlers of various WPF controls (DataGrid, ListView, Button) through the use of Relay Command and/or Event Triggers. 

In this particular case, I'm using a DataGrid WPF control inside an Esri Dockpane control and I would like to access the various event handlers of the DataGrid like MouseDoubleClick, CellEditEnding, etc. What are some way I can tap into these events within MVVM?

 There's suggestions that I have to download Blend SDK package or otherwise to access the behavior or interaction/interactivity namespaces in order to do something like the code below:

Source: c# - The name "Interaction" does not exist in the namespace "http://schemas.microsoft.com/expression... 

I found something similar here on GeoNet, but it is a very different use-case:

Source: https://community.esri.com/message/877665-re-wpf-and-mvvm-geoviewtapped-event?commentID=877665#comme... 

It seems as though the way to go is to bind a Relay Command to an Event Handler like the code examples above. Can anyone provide example on how this should work in the code spaces of the XML and VM?

Thank you in advance,

Sean

0 Kudos
0 Replies