System.IO.DirectoryInfo ds = d.GetDirectories("*.*", System.IO.SearchOption.TopDirectoryOnly) įoreach (System.IO.DirectoryInfo var in ds) System.IO.DirectoryInfo d = new System.IO.DirectoryInfo(root) Private void Button_Click(object sender, RoutedEventArgs e) Private void btnOpen_Click(object sender, RoutedEventArgs e) The code for : public partial class MainWindow : Window I will show you my demo to get content for folders and subfolders. You can use to open the folder, and you can use it like below to get the path. Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. If the response is helpful, please click " Accept Answer" and upvote it. You can create a field public bool StatusForCheckBox for MyModel to identity selected or not: private void Save_Click(object sender, RoutedEventArgs e)įoreach (MyModel obj in myList.ItemsSource) MyModel.Name = System.IO.Path.GetFileNameWithoutExtension(element) myModel.Name = System.IO.Path.GetFileName(element) String dicFileList = Directory.GetFiles(root, "*.txt", SearchOption.AllDirectories) openFileDlg = new () Ĭode to get the txt in folder and subfolders: private void Button_Click(object sender, RoutedEventArgs e) You can use both OpenFolderDialog and FolderBrowserDialog after you adding the in the project's reference.Ĭode to get the folder location: private void btnOpen_Click(object sender, RoutedEventArgs e)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |