I am trying to use the MVVM pattern to write a WPF application. I am using a WPF data grid (from the toolbox) that lacks an autofiltration function. Therefore, I want to implement it. I added a context menu to the column header template, it has a MenuItem called "Filter", which should actually call the filter method.
So, I installed the MenuItem command as the appropriate delegate command that goes into the ViewModel. The problem is that I need to pass information about the actual column that was right-clicked! If I had not used MVVM, I would have executed an event handler that would receive the sender argument (MenuItem), then I would have found its parent (ContextMenu), and then its parent provided me with a column. But how can I achieve the same here? How to transfer the sender to my team? Can this be done using ComandParameter?
I really do not want to use additional complex templates to achieve such a simple task. In the end, MVVM should simplify development, not the other way around ...
source
share