Reputation: 549
I have following EventTrigger
in DataGrid
definition:
<i:Interaction.Triggers>
<i:EventTrigger EventName="AutoGeneratingColumn">
<i:InvokeCommandAction Command="{Binding ColumnGeneratingCommand}"
CommandParameter="{???}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
What should I declare as a CommandParameter
to pass sender
(which should be column) to the ColumnGeneratingCommand
? Leaving this field empty leaves the command parameter empty as well (the passed object is a string
"None").
Upvotes: 0
Views: 467
Reputation: 169270
What should I declare as a
CommandParameter
to passsender
(which should be column) to theColumnGeneratingCommand
?
The implementation of InvokeCommandAction
doesn't support passing a reference to the sender
and if you really need this in your view model, you are doing things wrong because this breaks the MVVM pattern and what it's all about.
You need to rehink your design or create your own custom InvokeCommandAction
class. A view model should never have any direct reference to a UIElement
.
Upvotes: 1