I want to join a list and bind them within a TextBlock
in a GridView
(or ListView
) block.
Let me draw a picture to explain the scenario.
C#
I have a list of StudentInfo
which contains Name (string
), ID (int
) and Courses (List<string
)
XAML
<ListView.ItemTemplate>
<DataTemplate x:DataType="data:StudentInfo">
<StackPanel>
<TextBlock Text="{x:Bind StudentName}" Margin="1"/>
<TextBlock Text="{x:Bind ID}" Margin="1"/>
<!--In the following textblock, I want to show something like this
"Taken Courses Are - PHY, CHM, MAT"-->
<TextBlock Text="{x:Bind Courses}" Margin="1"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
In the last TextBlock
I want to join all the courses a student have taken and show them with a hard coaded text -
"Taken Courses Are - ".
How can I do that?