Calendar
Recent posts
Post categories
Syndication
Search
New download: Ookii.Dialogs
I have made available a new download: Ookii.Dialogs.
Ookii.Dialogs is a class library that provides a number of common dialogs for use in .Net applications. The dialogs provided are the task dialog, progress dialog, credential dialog, input dialog and Vista-style common file dialogs.
The download contains two class libraries, one for Windows Forms and one for Windows Presentation Foundation (WPF). The contents are nearly identical; only the input dialog is not available for WPF. Some utility classes are provided for Windows Forms; these are not available for WPF either.
Most of these dialogs are wrappers around Windows API functionality. The TaskDialog class wraps the task dialog API provided in Windows Vista and later. The ProgressDialog class wraps the IProgressDialog API available since Windows 2000. The CredentialDialog class wraps the CredUI API introduced in Windows XP, and the VistaOpenFileDialog, VistaSaveFileDialog and VistaFolderBrowserDialog classes wrap the IFileDialog API introduced in Windows Vista. Only the InputDialog is not a wrapper; this is a custom dialog that performs the same functionality as the old Visual Basic InputBox function. Visit the link above for more details on each dialog.
Each class has been designed to be not merely a wrapper around their respective native API, but to provide a programming interface that is natural to .Net developers, with full support for the component designer. The complete source code of the class libraries, as well as documentation and a sample application are provided.
The classes aim to give the best experience possible on each OS, where applicable. In the case of the CredentialDialog class, this means that the new Vista-style dialog is automatically used on operating systems that support it (Vista and newer). The Vista-style file dialog classes will automatically fall back to the old style dialogs when using Windows XP. This is also true of the VistaFolderBrowserDialog class for WPF, even though WPF itself doesn't provide a folder browser dialog; the VistaFolderBrowserDialog class is a full folder browser dialog implementation for WPF supporting XP and newer.
This library replaces the Ookii.VistaDialogs library, which contained only the Vista-style file dialogs and didn't offer any support for WPF.
This library is a collection of classes that I have developed for personal use over the years. Because of the difference in age of some of the code, and the many modifications made over time, there may be some inconsistencies.
Let me know what you think of it, if you use it.
Categories: Software, General computing, Programming
Posted on 2009-01-28 11:54:11 UTC.

Comments
Nice work, Sven! :)
Posted by Christian Liensberger on 2009-01-28 12:46:04 UTC
Please email me, urgent!
Posted by Long Zheng on 2009-02-02 04:55:28 UTC
The dialogs look great, might add some of them to my applications.
I am running Windows Server 2008 x64. When I use the Vista style Credentials Dialog, the Username and Password contains garbage. With the older style dialog, there is no issue. I am guessing it some weird buffer issue with packing/unpacking. Have you seen it and/or know the solution?
Posted by ltctech on 2009-04-01 00:35:06 UTC
Sorry abut this comment cause its not related to your post. but I really needed to thank you about your Brightness Controller software and adding a comment seems the only way to contact you.
thank you again for that perfect software and may we meet up again in future :)
details:
http://www.amilo-forum.com/post,8415.html#p8415
Posted by Hamy on 2009-04-11 10:11:11 UTC
Hi Sven and ltctech,
To fix the issue with CredentialDialog.cs,
replace (line 775)
-------
UserName = userName.ToString();
Password = password.ToString();
with
----
UserName = userName.ToString(0, userNameSize);
Password = password.ToString(0, passwordSize);
Hope this helps
Posted by Gael on 2009-04-17 19:48:03 UTC
i won't downlode
Posted by noobo on 2009-05-08 22:47:53 UTC
Awesome! Thank you so much. I was needing a FolderBrowser dialog in a WPF application, and this saved me the time to wrap the necessary Win API calls.
Posted by Anthony Kilhoffer on 2009-07-10 21:31:38 UTC
When I use your WPF VistaFolderBrowserDialog in XP, the description comes out as a row of 'boxes'. Any idea why this might be?
Posted by Steve on 2009-07-28 20:59:24 UTC
To fix the garbage characters problem with WPF VistaFolderBrowserDialog in XP,
Add the following code before "public struct BROWSEINFO" in the NativeMethods.cs
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
Posted by Zzz on 2009-08-23 13:49:10 UTC
I try to figure it out how to use the Glass.DrawCompositedText with no luck, can you send me a sample how to use it. THANKS.
Posted by jmatos on 2009-09-20 23:20:17 UTC
This stuff is great. Thanks for posting a fix to the garbage chars issue. Have you though of migrating this to Codeplex so we can help support it?
Posted by DrFooMod2 on 2009-10-20 16:29:09 UTC
I spoke too soon. If you replace with this:
UserName = userName.ToString(0, userNameSize);
Password = password.ToString(0, passwordSize);
The code won't build do to:
Error 2 Argument '2': cannot convert from 'uint' to 'int' C:\src\Ookii\Dialogs\src\Ookii.Dialogs.Wpf\CredentialDialog.cs 775 53 Ookii.Dialogs.Wpf
If you use this construct:
UserName = userName.ToString(0, userName.Capacity);
Password = password.ToString(0, password.Capacity);
It will build. However, I find that if, and only if, I set the ShowSaveCheckBox property to true does the UserName property include garbage.
Email me so we can discuss. Thanks.
Posted by DrFooMod2 on 2009-10-20 16:41:43 UTC
I'm sorry, I've been aware of this issue for some time but have not had time to fix it and re-release.
In truth, although Gael's fix works (you just need to cast them back to int; using Capacity instead won't work), there are other issues with the new-style dialog on Vista. In particular, if ShowUIForSavedCredentials is true, on Vista the password box will not be populated with the stored password. This is a bug in the Vista version of the credential dialog, it's not a bug with my code, and I have no way to work around it.
I would therefore suggest that you change line 458 from:
if( NativeMethods.IsWindowsVistaOrLater )
to:
if( Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version >= new Version(6, 1) )
This limits the new-style dialog to Windows 7, and causes Vista to use the old-style dialog, which does behave correctly in all circumstances.
Posted by Sven Groot on 2009-10-21 00:35:45 UTC
Worked like a charm. Just as a side note, it was like 456. Thanks again and I still think this should be moved to Codeplex.
Posted by DrFooMod2 on 2009-10-21 19:42:38 UTC
Hi Sven. Maybe stupid questions, but I am new to Windows/C# programming world :-)
a) does your library actually paint/compose those controls or is it just wrapping system controls?
b) I desperately want UI of Windows Explorer on Windows 7/Vista in the app I am coding (I want those breadcrumbs, toolbar, advanced list view items like those under Computer node...). Is it possible?
-M
Posted by Martin on 2009-10-31 23:00:00 UTC
Hi Sven, great work! I was looking for a way to display the native CredentialDialog but needed to store domain credentials. I've made a few changes to CredentialDialog.cs and it seems to work ok. Happy to send it to you, just let me know.
Regards,
Paul.
Posted by Paul on 2009-11-12 04:49:34 UTC