I want to disable the cell/Column based on some business logic. I am using ShowingEditor
event and ShowingEditorEventArgs
to cancel it. Passing ShowingEditorEventArgs
would be excellent.I am able to pass the full grid as an argument. using below code. But i just want to pass ShowingEditorEventArgs
of selected cell.May be some relative resource binding help me out here.
<dxg:GridControl x:Name="grid" >
<dxg:GridControl.View>
<dxg:TableView Name="view" ShowingEditor="view_ShowingEditor">
<i:Interaction.Triggers>
<i:EventTrigger EventName="ShowingEditor">
<i:InvokeCommandAction Command="{Binding ShowingEditorCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType={x:Type dxg:GridControl}}}" />
... Note:
interactions are not giving me CallMethodAction.
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
<ei:CallMethodAction
I don't want to pass the binded property of ViewModel
(e.g. SelectedItem
)
Consider using the DevExpress MVVM Framework, where you can pass event args to the view model as a parameter:
<dxmvvm:Interaction.Behaviors>
<dxmvvm:EventToCommand EventName="ShowingEditor" Command="{Binding ShowingEditorCommand}" PassEventArgsToCommand="True" />
</dxmvvm:Interaction.Behaviors>
Or even convert the EventArgs object before passing it to your command using a converter specified by the EventArgsConverter property.
Take a look at the EventToCommand article to learn more.
P.S. If you cannot use DevExpress MVVM Framework for some reason, this post describes how to implement a custom TriggerAction passing event args to a command manually.