// create a new item in list
        private void BtnNew_Click(object sender, RoutedEventArgs e)
        {
            vm.EditCity = new CityInfo();
            CityDetail cd = new CityDetail(vm)
            {
                Owner = this,
                WindowStartupLocation = WindowStartupLocation.CenterOwner
            };

            cd.ShowDialog();
        }
 private void LbData_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (vm.SelectedCity != null)
     {
         vm.EditCity = vm.SelectedCity.Copy();
         CityDetail cd = new CityDetail(vm)
         {
             Owner = this,
             WindowStartupLocation = WindowStartupLocation.CenterOwner
         };
         cd.ShowDialog();
     }
 }
 // use edit button or double click to edit the item in list
 private void BtnEdit_Click(object sender, RoutedEventArgs e)
 {
     if (vm.SelectedCity != null)
     {
         vm.EditCity = vm.SelectedCity.Copy();
         CityDetail cd = new CityDetail(vm)
         {
             Owner = this,
             WindowStartupLocation = WindowStartupLocation.CenterOwner
         };
         cd.ShowDialog();
     }
 }