Dear,

I'm really new in c# WPF and I need to develop a program that read a directory with sub-directories and files. For each directory I need to create a form and for each file a button.

the directory structure is:
c:\dir1
c:\dir2\subdir1\file.pdf
c:\dir3\subdir1\file1.pdf
c:\dir3\subdir1\file2.pdf
C:\dir3\subdir2\file21.pdf

If it's possible, how can I create it dynamically? I don't like to change the program every time a directory will be added or deleted.

There is an article on how to create vb.net controls with events at runtime here. After you read it please feel free to post any questions you have here. I realize that you are coding in C# but the technique is the same. I'll try to code up a C# example for you.

Guess this article would be a good starting point to get your files and directories.

If you google "c# wpf create control at runtime" you get a number of hits.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.