private void TemplateListBox_Drop(object sender, DragEventArgs e) { Dispatcher.BeginInvoke(DispatcherPriority.Render, (SendOrPostCallback) delegate { _context = (ManagerContext)DataContext; if (e.Data.GetDataPresent(DataFormats.FileDrop, true)) { string[] droppedFilePaths = e.Data.GetData(DataFormats.FileDrop, true) as string[]; if (droppedFilePaths != null) { foreach (var path in droppedFilePaths) { if (path.EndsWith(".html")) { // Add the template as slide to the Templates list _context.AddEditorTemplate(path); } } } } }, null); }