wpf c# select folder path

C#
    var dialog = new FolderBrowserDialog();
    dialog.ShowDialog();
    folderpathTB.Text = dialog.SelectedPath;
Source

Also in C#: