public void Browse(object obj)
{
if (obj is string ival)
{
Winforms.FolderBrowserDialog fbd = new Winforms.FolderBrowserDialog
{
RootFolder = Environment.SpecialFolder.DesktopDirectory,
Description = "Select Folder",
ShowNewFolderButton = false
};
if (fbd.ShowDialog() == Winforms.DialogResult.OK)
{
if (ival == "0")
{
TextBox1 = fbd.SelectedPath;
TxtBlock = string.Join("\n", Directory.GetFiles(fbd.SelectedPath)
.Select(file => Path.GetFileName(file)));
} else if (ival == "1")
{
TextBox2 = fbd.SelectedPath;
TxtBlock2 = string.Join("\n", Directory.GetFiles(fbd.SelectedPath)
.Select(file => Path.GetFileName(file)));
}
}
}
}
private string textBox1;
public string TextBox1 {
get => textBox1;
set {
textBox1 = value;
OnPropertyChanged(nameof(TextBox1));
}
}
private string textBox2;
public string TextBox2 {
get => textBox2;
set {
textBox2 = value;
OnPropertyChanged(nameof(TextBox2));
}
}
private string txtBlock;
public string TxtBlock {
get => txtBlock;
set {
txtBlock = value;
OnPropertyChanged(nameof(TxtBlock));
}
}
private string txtBlock2;
public string TxtBlock2 {
get => txtBlock2;
set {
txtBlock2 = value;
OnPropertyChanged(nameof(TxtBlock2));
}
}