private void On_CMB_FileCount_SelectionChanged(object sender, SelectionChangedEventArgs e) { int selCount = CMB_FileCount.SelectedIndex + 2; while (_fileColle.Count > selCount) { _fileColle.RemoveAt(selCount); } while (_fileColle.Count < selCount) { CopyFileVM addFile = new CopyFileVM(); _fileColle.Add(addFile); } }
private void On_Border_Drop(object sender, DragEventArgs e) { _vm = this.DataContext as CopyFileVM; if (_vm == null) { return; } String[] dropFiles = (String[])e.Data.GetData(DataFormats.FileDrop); _vm.FilePath = dropFiles[0]; try { _vm.ImageObject = LoadImage(_vm.FilePath); } catch (Exception ex) { Debug.WriteLine(String.Format("Set image source fail:{0}", ex.Message)); String fileExt = System.IO.Path.GetExtension(_vm.FilePath); _vm.FileDesc = String.Format("{0} file", fileExt); _vm.ImageObject = null; } }