Current filter:
                                You should refresh the page.
                                  • I fail to bind a command to a DXGrid - Column. I have tried many different gestures so that the grid doesn't snatches the event.
                                    I ended up with "Ctrl+F12", which works fine at grid or row level but doesn't at column level.

                                    [XAML]
                                    <dxg:GridControl AutoGenerateColumns="AddNew" EnableSmartColumnsGeneration="True" ItemsSource="{Binding Items}" SelectedItem="{Binding Current}" > <dxg:GridControl.View> <dxg:TableView ShowTotalSummary="True"/> </dxg:GridControl.View> <dxg:GridColumn FieldName="FirstName" IsSmart="True"/> <dxg:GridColumn FieldName="LastName" IsSmart="True"> <dxg:GridColumn.InputBindings> <KeyBinding Gesture="Ctrl+F12" Command="{Binding TestCommand}" /> </dxg:GridColumn.InputBindings> </dxg:GridColumn> <dxg:GridColumn FieldName="IsAlive" IsSmart="True"/> </dxg:GridControl>

                                    Regards
                                    Wolfram

                                1 Solution

                                Creation Date Importance Sort by

                                Hello,

                                GridColumn doesn't exist in the visual tree, that's why the KeyBinding doesn't work. Instead, you can define your KeyBinding at the GridControl level, pass the current column's FieldName as a parameter, and check it in the CanExecute method:

                                [XAML]
                                <dxg:GridControl.InputBindings> <KeyBinding Gesture="Ctrl+F12" Command="{Binding TestCommand}" CommandParameter="{Binding CurrentColumn.FieldName, ElementName=grid}"/> </dxg:GridControl.InputBindings>

                                I modified your project to demonstrate this approach. Let me know if it's suitable.

                                • tungsten68 08.24.2019

                                  Thank you very much. It works just fine now. 

                                • André (DevExpress Support) 08.25.2019

                                  You're welcome.