private void AddButtonClick(object sender, RoutedEventArgs e) { ScriptInfoItem item = new ScriptInfoItem( new ControlInfo { ControlId = "TestId", WindowId = "Id", WindowTitle = "Title" }); if (this.dragMgr.IsDragInProgress) { return; } (listView.ItemsSource as ObservableCollection <ScriptInfoItem>).Add(item); }
void OnListViewDrop(object sender, DragEventArgs e) { if (e.Effects == DragDropEffects.None) { return; } ScriptInfoItem item = e.Data.GetData(typeof(ScriptInfoItem)) as ScriptInfoItem; if (sender == this.listView) { if (this.dragMgr.IsDragInProgress) { return; } } else { (this.listView.ItemsSource as ObservableCollection <ScriptInfoItem>).Remove(item); } }