Windows Explorer control for WPF? - c#

Is there a way to have a Windows Explorer on WPF? The closes I can get is the Web Browser, but it's not really what I need.
Please assist.
Thanks

Check these out -
http://www.codeproject.com/KB/WPF/WPF_Explorer_Tree.aspx
and
http://gargmanoj.wordpress.com/2009/03/27/wpf-101-a-simple-windows-explorer-like-directory-browser/

JAM Software recently released a WPF edition of their ShellBrowser controls. They contain a wrapped Windows Explorer as well as custom built tree and list controls. Also included is a preview control similar to the one in the Windows Explorer on the right. Full disclosure: I am one of the developers of ShellBrowser.

Check out the explorer browser control in the Windows API Code Pack. Compatible with Vista and 7, I believe.

I have written a WinForms library that might help. It's not WPF but you can host it in a WPF application.
You can find the library at: http://gong-shell.sourceforge.net/

You can also check this out. It's fresh to the market and you'll need to pay, but it was designed to be identical in every way to the Windows Explorer Chrome:
http://www.teraque.com/products/explorer-chrome-suite/
The controls you get for free from WPF look like crap. They are only meant to get developers started.

Related

C# - WPF - getting folder browser dialog without using System.Windows.Forms?

I have this WPF app and I want to have there function of getting a directory path from the user. I would like to use some folder browser dialog but I don't want to implement it from System.Windows.Forms or use some huge script inside. Is there some path getting dialog in WPF already implemented?
I have read answers to similar questions here but it was full of System.Windows.Forms..
I haven't found anything like that in the Toolbox and I'm starting with WPF so I could use some help.
Thank you in advance :]
See my answer to Select folder dialog WPF. Basically the Windows Presentation Foundation 4.5 Cookbook recommends that you use the Windows® API Code Pack for Microsoft® .NET Framework if you need a folder browser.
we use Ookii Dialogs in our projects. They have the windows-look and feel and the typical options for filtering etc.
There are no standard native WPF dialogs for what you are looking for, simply because the System.Windows.Forms dialogs are nothing more than wrappers to the system ones. So creating a WPF wrapper makes no sense and will only add to the confusion.
The Ookii Dialogs for WPF library has a VistaFolderBrowserDialog class that provides a complete implementation of a folder browser dialog for WPF.
https://github.com/augustoproiete/ookii-dialogs-wpf
There's also a version compatible with Windows Forms apps

Use WPF Controls in Web project

I created another WPF project in my asp.net project solution and now want to use my WPF controls in my web application. Is it possible to use wpf control in my web projects?? I figure out on internet some says like you have to use Silverlight for web applicaitons. As far I know silverlight is subpart of WPF, so why not i can use WPF??. I have to use WPF controls because already did enough efforts to build wpf controls and now wanna to use in Web application.
Yes, you can embed WPF controls in a webpage, but you'll need the relevant plug-in enabled (much like Silverlight).
As an example the Xceed Datagrid for WPF is viewable within Internet Explorer.
Although XAML applications are disabled by default, you'll need to enable them in your Internet Explorer security settings.
As for Firefox, you'll need both the .Net Framework Assistant, and WPF Plugin as suggested by MSDN.
WPF is a really great framework, and enabling WPF/XAML based applications for intranet usage would be fine (you could inherit the security permissions through group policy), or for a set audience who don't mind the extra configuration.
The only way you can achieve that is by using Silverlight components not WPF. As you said silverlight is a subset of WFP, so not all WPF features are supported but the silverlight runner. For the most part, the visuals are fully compatible, that is user controls, so if you did not use anything that is specific to WPF then you should be grand.
maybe check here:
WPF vs Silverlight
BTW can you post your xaml, so that we get an idea?
Marco
I believe you can use the XML WPF Browser application to do this, but I'd probably not recommend it, as I think your users will have to download client-side components in order for it to run. The following link gives more info.
http://msdn.microsoft.com/en-us/library/aa970060.aspx
No you cannot use WPF in a web page. WPF is for Windows Applications and will only run on Windows machines. The internet is device agnostic and will run on Windows, Linux, Android, iOS etc. Therefore you need to use ASP .NET (or similar) for web applications and WPF for Windows.
Silverlight is a sub-set of WPF and will work on a web page... BUT not all devices support it (i.e. iOS). So if you really want to be system agnostic and true to the spirit of the web use HTML / CSS and JavaScript.
Whatever it is possible or not, the using of WPF controls embedded in a html page is just horrible.
A classic WPF control might be running (after changed browser settings), but there are many security concerns. Furthermore you have to show your users a to do list before anyone could see the real page.
Silverlight as a subset of WPF, but it is also a plugin that is not available for all platforms such as, for instance, iOS.
I recommend to use HTML 5, which is a per se standard and viewable on all other platforms. It causes more effort, but is is definitely worth it.
Although there are ways to do this (already mentioned by other users on this page), relying on your visitors to have this configured or plugins installed in their browsers means it's very risky to implement this (assuming your target is the WWW and not just local users).
I would consider building a web application UI and just reference everything via class libaries (if using N Tier design)

Use a webpage as the UI in a C# desktop application?

I'm building a C# desktop app with a simple UI. Due to my familiarity with HTML/CSS, and a previous web-based iteration of a very similar app, it would be ideal if I could re-use some existing HTML/CSS pages I have as the UI for this new desktop app.
Is that do-able with C#? Can anyone show a simple example of using an HTML/CSS page as the UI of a C# desktop application?
Other answers are dated, new good options:
Electron + Electron-Edge - is the way to go for a new Electron app that communicates to a .NET backend (a DLL). Widely used and supported.
Neutronium - best for already-written .NET WPF apps that need a HTML UI. Requires using Vue. Less popular and less supported.
CefSharp (https://github.com/cefsharp/CefSharp) is a good way to embed chromium, but you still need a web server. Take a look at http://www.ultidev.com/products/Cassini/ to alternative for IIS.
You can use WebBrowser control to add Web browser functionality to your application.
You can create your own html(s) and set your WebBrowser control to display those pages. You can navigate by clicking hyperlinks or by using keyboard shortcuts to move backward and forward through navigation history. By default, you can access additional browser functionality through the right-click shortcut menu
You can even manage those pages centrally (for e.g. on LAN) and all clients on LAN can connect to this central location. This way you can modify pages centrally.
Check a walkthrough on MSDN:
How to: Add Web Browser Capabilities to a Windows Forms Application
You can try to use a Chromium-based control - DotNetBrowser. This control provides wide interactivity options, like DOM manipulation and DOM events, which can be useful in your case.
In addition, there is an article that demonstrates how to use a web page as HTML UI in a C# desktop application: https://www.infoq.com/articles/html-desktop-net
Affiliation disclosure: I work with the team, which created DotNetBrowser.
You could try adding a Web Browser control to a forms application to show your page. But this will need to be remotely hosted as the code will not be able to execute locally, except if you listen for the specific links in c# and then perform the actions.
You could also try your hand at WPF which is a new technology to create good looking gui's with mark-up much like html, which you'll pick up pretty quickly with your html experience.
Unfortunately neither WinForms or WPF is sufficiently like HTML/CSS to be of that kind of use. You'll be able to reuse the layout-concepts and art of course. And, with WPF being the closest thing to it, you might even keep a lot of the code-behind code.
But the short answer is: No

How to create an Explorer-like folder browser control?

Using C# and WinForms in VS2008, I want to create a file browser control that looks and acts like the left pane in Windows Explorer. To my astonishment, such a control does not ship with .NET by default.
Ideally, I would like its contents to be exactly the same as in Explorer. For example, on Windows 7, it should show the Favorites and Libraries pseudo-folders. Of course, I do not want to code specifically for each version of Windows if I can help it.
I have browsed around, and there are some examples of such controls, but they are all hand-rolled and therefore won't work 100% the same as the one in Explorer.
Is there any way I can simply reuse the Explorer control instead? Or, if not, to get access to a tree of the items that it would show?
Microsoft provides a walkthrough for creating a Windows Explorer style interface in C#.
There are also several examples on Code Project and other sites. Immediate examples are Explorer Tree, My Explorer, File Browser and Advanced File Explorer but there are others. Explorer Tree seems to look the best from the brief glance I took.
I used the search term windows explorer tree view C# in Google to find these links.
It's not as easy as it seems to implement a control like that. Explorer works with shell items, not filesystem items (ex: the control panel, the printers folder, and so on). If you need to implement it i suggest to have a look at the Windows shell functions at http://msdn.microsoft.com/en-us/library/bb776426(VS.85).aspx.
Take a look at Shell MegaPack control set. It provides Windows Explorer like folder/file browsing with most of the features and functionality like context menus, renaming, drag-drop, icons, overlay icons, thumbnails, etc

How to display PDF or Word's DOC/DOCX inside WinForms window?

I'm wondering what's the best option to display a pdf/doc document inside form in my c# winforms app.
This control should only allow do display preview. Edtiting documents should be forbidden.
I'm looking for free solution.
The best option would be to attach a few separate *.dlls to solution but it's not a requirement.
Consider using the preview handlers for Vista, Windows 7.
I used the code provided by Brad Smith (with corrections from the comments).
http://www.brad-smith.info/blog/archives/79 - Hosting Preview Handlers in Windows Forms Applications
An often suggested solution is to use a webbrowser component inside the form that views the PDF:
MSDN
Another approach is to use an ActiveX Control included with the Adobe Acrobat Reader but therefore you need a license from Adobe.
You can use Preview Handlers. There is a WPF Article over at CodeProject, which should be dead easy to translate to WinForms if you need it.

Categories

Resources