Home > other >  WPF click in the Datagrid border, get in line and selected
WPF click in the Datagrid border, get in line and selected

Time:01-23


XMAL parts as follows:

 & lt; DataGridTemplateColumn Header="operating" Width="*" & gt; 









requirement:
For & lt; Border x: Name="borderDelete"/& gt; Set the MouseLeftButtonDown="borderDelete_MouseLeftButtonDown" events,
Want to click Borde controls in the "edit" or "delete", after obtaining the DataGrid is click on the line, and selected, return DataGrid1. SelectedItem,

CodePudding user response:

Has been resolved, change the way of thinking, no longer get DataGrid1. SelectedItem, but DataContext accessed by the sender, so as to change the database,
 var bd=sender as Border; 
Var fakeDatabase=bd. DataContext as fakeDatabase;

CodePudding user response:

There is insufficient place, please point out. Thanks
  • Related