C# WPF Tutorial #11 - FolderBrowserDialog - How to use Winforms In WPF!

preview_player
Показать описание
Using the WinForms FolderBrowserDialog control to not only learn how to open a folder picker, but also how to incorporate WinForms controls inside of a WPF application! Also learn a few useful tips about project files and using aliases to keep pesky ambiguous reference errors away!

Happy Coding!

Chapters:
0:00 Intro
0:22 Setup
0:30 Important Info!
1:31 How to Enable WinForms in WPF
2:21 Ambiguous Reference Issues
3:08 Using Aliases
3:51 Setting Initial Directory
4:32 Firing the Dialog
5:10 Getting the Dialog Results
6:55 Next Up
Рекомендации по теме
Комментарии
Автор

Man these videos are just great. Clear speaker. Clear and concise content. Direct information. You're really killin it. Thanks for the hard work

kausemustream
Автор

This was exactly what I was looking for! Thank you for these tutorials, they're going to make this project I'm working on a lot easier.

GeneralWarburg
Автор

Impressive! Your teaching style is really good and straight to the point. Thanks a lot!

SouhaibD
Автор

Love that you explain common mistake among junior developers (like me). I think it’s just as important as explaining the concept. It helps new learners avoid a lot of unnecessary mistakes and save a lot of time as well. Thanks for the videos. Really effective and straight to the points ❤

Stars.Stripes.andVan
Автор

this entire tutorial is deeply underrated. As someone who i is used to using C++, i had no idea where to start with C# for making a gui. You clearly gave pro and cons for each framework and explain key features of WPF without detailing each detail of C#, while still pointing out some interresting features (booleans can be nullable here? wild!)

WIckedOmenOfThunder
Автор

Thanks so much for this series, I find myself coming back often to re-learn how to do things that I forget about! I look forward to more if and when you get to them! Your teaching methods are of great help in explaining everything and why and how you do it all. Thanks again!

belia_
Автор

Quick update as of 5/21/2024: Microsoft has now exposed OpenFolderDialog as an object accessible without going through the process of setting up a reference to Windows.Forms (Tested this today in Visual Studio 2022)...

You can simply do the following in your event handler, etc:

var folderDialog = new OpenFolderDialog();
folderDialog.Title = "Select Folder";

if (folderDialog.ShowDialog() == true)
{
var folderName = folderDialog.FolderName;
MessageBox.Show($"You picked ${folderName}!");
}

This avoids a few other gotchas that can come up when you explicitly reference Forms in the project configuration settings.

leeklaus
Автор

This one is certainly a great tip !! 😆😆 I have never expected I can use WinForms stuff in WPF. Kampa, but I'm wondering that if I selected to use WinForms in WPF, then will my wpf application size enlarge much more than wpf without WinForms? Or has it already optimized by MicroSoft?

wookyumkim
Автор

Hey, if I have two different user controls, how do i make them talk to each other? like a main window as parent, left panel user control, right panel user control (different), and i want a button on the left panel user control to change text inside right panel's user control

benkenobii
Автор

.NET 8 now has a "OpenFolderDialog" class for WPF, so this video is now redundant.

RoboGameOfficial
Автор

stupid question here but don't suppose there is anyway of styling this to look like the design you have for your program i assume not but thought i would ask incase you know of a way

elfenliedtopfan
Автор

How did you get ‘that’ dialog for browsing the folders, I am getting tree structured style dialog for browsing the folders.

kshanmukpandu
Автор

Hello um I am stuck. I can't use System.Windows.Forms as it make everything use it automatically and i can't turn it off by doing WinForms = System.Windows.Forms. I am using .NET 8 or 9 I just wanna open the FolderBrowserDialog

MoonCore-hhvu
Автор

At 2:06: Is there a reason why the True in the UseWindowsForms tag is capitalized, but in the UseWPF tag it's not?

tielessin
Автор

For me winforms seem like they were working when i used the using without going to the properties. But the method InitialDirectory is not found under dialog. Do you have an idea what could be wrong

cruzchaps
Автор

using .Net 6.0 LTS on VS2022
Even if WinForms alias is applied on using it still throw ambiguous reference error even in the App.xaml.cs (System.Windows.Application class ambiguous)
It seems that Windows.Forms is already loaded on using somewhere deeper in the framework/window's baseclass so it's still throwing errors.

Just checking the WPF and winform checkboxes on the properties break the project. still cant figure out how to use both, for now i use OpenFolderDialog.

muhammadfahmi
Автор

Not sure if this is a new feature or user error but once you allow System.Windows.Forms it is the automatic go to even without adding a Using. When I add a Using I get a message letting me know that it isn't necessary. Also, if you enable it in your project it gets added to all files. I had a few errors that were fixed by adding things like and "System.Windows.Application" even though those scripts didn't have a using for windows forms.

isakjones
Автор

01:46 I have 2019 Edition but it does not have this feature even layout (interface)

sbasalan
Автор

I d love to contribute but I dont use credit card, my options are paypal and bank transfer would you be kind to inform me how should I move forward ? may I access your info mail or something like this ?

volkangundogdu
Автор

Nope they still did not solve the intellisence for FolderBrowserDialog (They broke it more, it doesnt show using anymore for this .d)

berkefekeskin
visit shbcf.ru