I made a wpf DataGrid which invokes from a list of file names and their score. The grid works just fine, and now I'm trying to make it available for the user to click on a row and it reveals the file content itself (text files). The text string is very large and therefore I don't want it to be an attribute of the list. Instead I want the file path to be the attribute and a streamer will read the file whenever I click a row.
I'm coding in c#. This is my (partial) code so far:
public class DataLeakageScorer
{
public string fileName { get; set; }
public string score { get; set; }
public string path { get; set; }
public DataLeakageScorer(string fileName, string score, string path)
{
this.fileName = fileName;
this.score = score;
this.path = path;
}
}
and my XAML:
<Grid>
<Button x:Name="button" Content="Browse" HorizontalAlignment="Left" Margin="464,22,0,0" VerticalAlignment="Top" Width="75" Click="browse"/>
<Label x:Name="status" Content="Please select a folder" FontSize="15" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" HorizontalAlignment="Center" Margin="0,5,121,0" VerticalAlignment="Top" Width="459" Height="52"/>
<DataGrid Name="scoresTable" AutoGenerateColumns="False" IsReadOnly="True" CanUserSortColumns="False" Margin="0,62,0,0">
<DataGrid.Columns>
<DataGridTextColumn Header="File Name" Binding="{Binding fileName}"/>
<DataGridTextColumn Header="Score" Binding="{Binding score}"/>
</DataGrid.Columns>
</DataGrid>
</Grid>
Thank you and sorry if I wasn't clear enough