I have a list of string in my viewmodel which gets populated in the run time with filenames like Events.csv etc. I am binding this list as an itemssource to the DataGrid but it shows the length of the string rather than the string. Please help.
Don't worry about the INotifyPropertyChanged and DATACONTEXT. The DataContext is set correctly to the DetailedRunInformationViewModel and other pieces of data in this view are populating correctly.
Please see the attached screenshot when I debug.

ViewModel:
public class DetailedRunInformationViewModel : RunRelatedErrors
{
public List<string> AllFilesGeneratedList { get; set; }
public DetailedRunInformationViewModel(int sessionID, RunData runData)
{
DisplayAllFiles();
}
public void DisplayAllFiles()
{
if (_runData != null)
{
if (_runData.CSVDataInDataTableFormatForEachFile != null && _runData.CSVDataInDataTableFormatForEachFile.Count > 0)
{
if (AllFilesGeneratedList == null)
{
AllFilesGeneratedList = new List<string>();
}
foreach(var key in _runData.CSVDataInDataTableFormatForEachFile.Keys)
{
AllFilesGeneratedList.Add(key);
}
}
}
}
}
In the xaml
<DataGrid
x:Name="AllRunFiles"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Margin="{StaticResource AllControlsMargin}"
ItemsSource="{Binding AllFilesGeneratedList}"
AutoGenerateColumns="True">
<i:Interaction.Triggers>
<i:EventTrigger
EventName="SelectionChanged">
<i:InvokeCommandAction
Command="{Binding OpenSelectedFile}"
CommandParameter="{Binding ElementName=AllRunFiles,Path=SelectedValue}"></i:InvokeCommandAction>
</i:EventTrigger>
</i:Interaction.Triggers>
<DataGrid.ItemTemplate>
<DataTemplate>
<TextBlock
Text="{Binding}"
Style="{StaticResource TextBlockHyperlinkStyle}"></TextBlock>
</DataTemplate>
</DataGrid.ItemTemplate>
</DataGrid>