private void btnChangeLimits_Click(object sender, System.Windows.RoutedEventArgs e) { var window = new DistributorWorkerUpdateWindow((e.Source as Button).DataContext as Worker); window.ShowDialog(); }