private void AddCheckPoint_Click(object sender, RoutedEventArgs e) { AddCheckPoints window = new AddCheckPoints(); if (window.ShowDialog().Value) { this.TransportViewModel.CheckPoints.Add(window.DataContext as RouteCheckpointInfo); } }