private void btnCapture_Click(object sender, RoutedEventArgs e) { CaptureWindow win = new CaptureWindow(); if (win.ShowDialog() == true) { byte[] data = win.CaptureData; ShowImg(data); Employee employee = (Employee)gridEmployee.DataContext; employee.Photo = data; } }