I have placed a Datagrid control on my WPF application and I'm trying to handle the mouse right click event on a row or a single cell of my Datagrid control. How can I achieve it? I've tried to capture the event with selectedItem executing the method but its not working "ciao"
Below is the xaml code:
<TabItem Header="Lista Dipendenti">
<DataGrid x:Name="gridListaDipendenti" Margin="64,42,73,65" SelectedItem="ciao"/>
</TabItem>
I wish I could execute some code when the user clicks a row or cell of the Datagrid and possibly get the value of the row (the ID).
In visual basic, if you want to access the numberOfTheColum element of the numberOfTheRow row:
dataGridObject.Items(numberOfTheRow).Row(numberOfTheColum)
Besides that, there is a event called MouseRightButtonUp or something like that:
MouseRightButtonUp="methodName"
In that method name is where you can access the datagrid elements or even the cell pressed with datagridObject.CurrentCell
Hope it help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With