I use% custom% to show userControl
and when I double-click on a line, I call a register window, which is expecting to send Data Grid
of the selected line as a parameter, I wanted to simplify passing this method of all screens from ID
to Data Grid
customized as virtual method, so in double click I would call only the method, but I can not pass the window name as a parameter.
Failed example of the userControl virtual method (in theory this would be)
public virtual void AbrirJanelaCadastro(Window window, DataGrid grid)
{
DataRow dataRow = (grid.SelectedItem as DataRowView).Row;
window(dataRow.Field<Int32>("ID")).ShowDialog();
}
Example of calling the method to open the window in double click
private void grid_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
if (e.LeftButton == MouseButtonState.Pressed)
AbrirJanelaCadastro(Cliente, Grid);