I have datagrid in wpf. When I do mouse-over on column header, There is one close button will appear.
I want to have some functionality so when I click on that button, whole column should be deleted.
I have wrote this.
<DataTemplate x:Key="AdornerDataTemplate">
<Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,0,0">
<Button Content="X" Width="26" Height="26" Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ctrls:RhinoDataGrid}}, Path=RemoveColumnCommand}" Background="{DynamicResource GridHeaderMouseOverBrush}"></Button>
</Grid>
I can see that RemoveColumnCommand is executed but it doesn’t have index of column. How would I know on which column I clicked.

Pls help me.
Thanks
Dee
You can try to pass the column as
CommandParametervia a binding. The index itself should not be needed.