You'll need a custom value converter to bind a list or array of strings to a textbox.
For example:
public class JoinStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var list = value as IEnumerable<string>();
return list is null ? null : string.Join(Environment.NewLine, list);
}
public object ConvertBack(object value, Type targetTypes, object parameter, CultureInfo culture)
{
string valueString = value as string;
return valueString is null ? null : valueString.Split(new[] { Environment.NewLine });
}
}
However, It would probably be simpler to join the strings in the view-model, and bind to the joined string property:
private string[] _selectedFiles;
public string[] SelectedFiles
{
get { return _selectedFiles ?? Array.Empty<string>; }
set
{
_selectedFiles = value;
OnPropertyChanged(nameof(SelectedFiles));
OnPropertyChanged(nameof(SelectedFilesString));
}
}
public string SelectedFilesString
{
get { return _selectedFiles == null ? null : string.Join(Environment.NewLine, _selectedFiles); }
set { SelectedFiles = value == null ? null : value.Split(new[] { Environment.NewLine }); }
}
<TextBlock Text="{Binding Path=SelectedFilesString}" Foreground="Yellow" />