How can I use FileOpenPicker to browse my install folder? - c#

I am building a C# Windows Store app and I want to include a few image files with it for the app background. I want to let the user pick one of these images for the app background or pick from their own pictures. The FileOpenPicker.SuggestedStartLocation is only useful for picking from a predefined set of start locations. FilePicker contracts are too complex, include extra UI that appears within the file picker page, and let other apps get to my image files when they really should not have that access.
The only viable alternative so far is to create my own file picker page that looks close to the built-in page, but this is an ugly solution to what should not be this hard.

The best way is to devise your own. Load your included images into a selectable GridView or such and add another button or a specific tile to let the user pick from elsewhere. I wouldn't try to make the basic functionality look like the file picker.
Neither the app's install location or app data folders are intended to be user data, so there isn't an in-box way to pick from them. Advanced users can point the FileOpenPicker at those locations, but there is nothing like SuggestedStartLocations to guide the user there.

Related

When creating a custom file extension, is it possible to assign it an icon different from the application icon?

Hello wonderful people!
I have created some code for an application which upon startup, simply makes sure the registry has a key for my own file extension (or I guess 'class', as Windows calls it). It allows me to double-click a file with said extension and have it open with my program. Simple.
My query is this; is it possible for me to change the icon for this file class, to be different from the icon of my application? I would prefer to have some different icons for the various file extensions I'm registering, much in the same way that Photoshop for example gives a different icon for .PSD files than the actual application icon.
In simpler terms, I would like to mimic this behaviour but with my own icons and application:
Photoshop (the actual application):
Photoshop Document file:
I am working in C# and WPF. And I should also specify that the solution I'm looking for should be able to work in a scenario where I was to send my application to someone else to install on their computer; they should be able to see all the icons as described. I'd kindly request that in your answers you provide code examples, as I am not particularly familiar with working directly with the registry.
I should also specify that my application does have an icon, and this is currently what the custom filetype displays in Windows Explorer.

How to change desktop/folders Icons size programmatically C#

I'm developing a WPF that needs to make desktop icons and folder icons bigger while the WPF is active
and returns them to their previous state when closing the WPF
basically I want to be able to control the following options programmatically:
Folders icons :
desktop icons:
also how to change folder option to single click mode :
Folder icon settings are often per-folder and you will have a hard time forcing your preferences on them. You can probably find some descriptions of the registry locations and format if you search the internet for "shellbags" but this puts you in undocumented territory.
The desktop icon mode can probably be changed by undocumented/hacky means but you should just let the user do it.
You might be able to change the double-click mode by playing with fDoubleClickInWebView and SHGetSetSettings.

Is there a button for moving items up and down in a listview?

I am coding a C# forms application where I have a ListView with multiple items.
I am wanting to move these items up and down and am wondering if there is a forms control that I can use for this, or should I get my own image, and add this to a simple button for both the up and down action?
Yes you simply create your own button with the desired image.
If you like to use the Microsoft images, you should take a look at the folder %ProgramFiles(x86)%\Microsoft Visual Studio 10.0\Common7\VS2010ImageLibrary. There you'll find (in another sub-folder) a VS2010ImageLibrary.zip file which contains lots of Microsoft images you are allowed to use within your applications. If you can't find your desired resolution you can take a look if you find a corresponding .ico file, cause these normally contains more resolutions then directly available as .png or .bmp file.

Drag control outside main window

It is more common to drag files to an application than to drag files from an application to directory in windows. In my wpf application I have a list of files. I will like to enable the user to drag those files (files are custom user control with an image and label) to the desktop for example. Is it possible to do that? Moreover I will like to use the default functionality of windows. That is if I drag the file to a new disk, partition then I will like the file to be copied. If the directory happens to be on the same partition as the file I will like to move that file.
Edit
I found lots of great examples such as this one. and the one that SvenG mentioned in the comments section of this question.
none of those examples work when I need to transfer large files. The mouse cursor and application does not let me interact until the copying or moving of the file is done. I tried ruining that on a separate thread and I have not been able to do so.

How do I browse the local directory's files without using OpenFileDialog? (C#)

I want to build something where the user to browse the local files on the application I am providing, the screen is actually identical to OpenFileDialog, but I do not want that to be a dialog but a control on my form.
I tried to use a Web Browser control, it works, but I have to write a bunch of navigation code in order for that to work, and another problem is if the user selected any files on that screen, I am not sure how to capture the results.
So is there another way to do that? Or maybe override some of the OpenFileDialog control to make it not only showing as a dialog but a normal control.
Thanks
Maybe something like this is what you are looking for:
It uses the tree view.
http://www.codeproject.com/KB/cs/TreeViewFileExplorer.aspx
It's better to use the openfiledialog and attempt to ownerdraw that (which I think you can enable).
Use controls from Shell MegaPack - they can be put on your own forms, and provide lots of customization and flexibility.
DISCLAIMER: I work for LogicNP Software, the developer of Shell MegaPack.

Categories