Пример #1
0
 public void Dropped(IDropInfo dropInfo)
 {
     if (dropInfo.DragInfo != null)
     {
         if (dropInfo.DragInfo.VisualSource == dropInfo.VisualTarget && dropInfo.Data.GetType() == typeof(FileNameItem))
         {
             FileNameItem filenameitem    = dropInfo.Data as FileNameItem;
             FileNameItem newfilenameitem = filenameitem.Clone() as FileNameItem;
             FilePaths.Insert(dropInfo.InsertIndex, newfilenameitem);
             FilePaths.Remove(filenameitem);
         }
     }
 }
Пример #2
0
        public void Drop(IDropInfo dropInfo)
        {
            var dataObject = dropInfo.Data as DataObject;

            if (dataObject != null)
            {
                if (dataObject.ContainsFileDropList())
                {
                    Mementor.BeginBatch();
                    var filedrop = dataObject.GetFileDropList();
                    foreach (string str in filedrop)
                    {
                        foreach (string fm in FileMask)
                        {
                            if (System.IO.Path.GetExtension(str).ToUpperInvariant() == fm)
                            {
                                FileNameItem lbfn = new FileNameItem(Mementor)
                                {
                                    FileName = str, FileIsSelected = false
                                };
                                FilePaths.Add(lbfn);
                                Mementor.ElementAdd(FilePaths, lbfn);
                            }
                        }
                    }
                    Mementor.EndBatch();
                }
            }


            if (dropInfo.DragInfo != null)
            {
                if (dropInfo.DragInfo.VisualSource != dropInfo.VisualTarget && dropInfo.Data.GetType() == typeof(FileNameItem))
                {
                    FileNameItem filenameitem    = dropInfo.Data as FileNameItem;
                    FileNameItem newfilenameitem = filenameitem.Clone() as FileNameItem;
                    FilePaths.Insert(dropInfo.InsertIndex, newfilenameitem);
                    Mementor.ElementAdd(FilePaths, newfilenameitem);
                }
            }
        }