开发者

multi select folders and files

it is possible to select multiple files using OpenFileDialog. (setting multiselect as true)

the question is how to select multiple files and folders at the same time?

I know what is FolderBrowseDialog, I know I should Hold ctrl or shift! :D

assume a folder contain 5 folder and 2 files, the scenario is to select for example 1 of files and 2 folders.

I don't know why people down vote th开发者_运维技巧is question!!

----------------- Edit --------------------

assume an OpenFileDialog, you can select as many file as you want in a folder, ok? I want something like this but with the ability to select folders too! so as OpenFileDialog return selected file names in FileNames array that dialog return something Like SelectedPaths array that contains filenames and folderpaths.


The Common Item Dialog (which replaces the Open File Name Common Dialog Box) has a few points of customization. I haven't tried, but by hooking IFileDialogEvents you should be able to change behavior as you need. (You might need to add some trickery, it was possible with an OFNHookProc in XP style file dialog)


Even though this means reading a lot of frustrating Microsoft documentation, It's preferrable over developing a custom dialog:

When copying a platform feature, you have to copy all of it.

That means e.g. pasting files through Ctrl+V, Shift+Ins or the context menu, and if that shell extension I just wrote doesn't work, I'm pissed.


I've done this in an application I built, and I ended up using a TreeView control and just mapping the hard drive into this control - each folder had a TreeNode, nested to match the folder structure, and then the files at the deepest level.

While it's memory-hungry, a user can select/de-select individual files, and it's pretty easy to automatically select/de-select all the children when somebody checks a parent folder.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜