<pre> <ListView x:Name="content" Grid.Row="1" SelectionMode="Single" SelectionChanged="content_SelectionChanged" ItemsSource="{x:Bind Customers}"
HorizontalAlignment="Stretch"
VerticalAlignment="Top" MinWidth="44" Background="Transparent">
<ListView.ItemTemplate>
<DataTemplate x:DataType="x:Bind">
<StackPanel Margin="0,0,0,5" x:Name="row2" Background="White" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Stretch" Width="auto">
<TextBlock Text="{Binding Name}"
Margin="3,10,36,0"
FontSize="13"
FontStyle="Italic"
FontWeight="Bold"
Foreground="DarkBlue"
Height="36"
Width="63"/>
<TextBlock Text="{Binding age}"
Margin="0,10,3,0"
FontSize="13"
FontStyle="Italic"
FontWeight="Bold"
Foreground="DarkBlue"
Height="36"
Width="50"/>
<TextBlock Text="{Binding mark}"
Margin="0,10,22,0"
FontSize="13"
FontStyle="Italic"
FontWeight="Bold"
Foreground="#ff4d94"
TextAlignment="Center"
Height="36"
Width="60"/>
<TextBlock Text="{Binding mark1}"
Margin="0,10,25,0"
FontSize="13"
FontStyle="Italic"
FontWeight="Bold"
Foreground="#ff4d94"
TextAlignment="Center"
Width="60"
Height="36" />
<TextBlock Text="{Binding mark2}"
Margin="0,10,32,10"
FontSize="13"
FontStyle="Italic"
FontWeight="Bold"
Foreground="#ff4d94"
TextAlignment="Center"
Height="36"
Width="60"
/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
What I have tried:
<pre> public class Customer
{
public object Id { get; set; }
public object Name { get; set; }
public object age { get; set; }
public int mark { get; set; }
public int mark1 { get; set; }
public int mark2 { get; set; }
public int total { get; set; }
}
public sealed partial class MainPage : Page
{
public ObservableCollection<Customer> Customers { get; } = new ObservableCollection<Customer>();
public MainPage()
{
this.InitializeComponent();
Customers.Add(new Customer() { Id = 1, Name = "NAME 1", age = 20, mark = 70, mark1 = 43, mark2 = 55, total = 0 });
Customers.Add(new Customer() { Id = 2, Name = "NAME 2", age = 20, mark = 46, mark1 = 53, mark2 = 52 });
Customers.Add(new Customer() { Id = 3, Name = "NAME 3", age = 20, mark = 50, mark1 = 63, mark2 = 75 });
Customers.Add(new Customer() { Id = 4, Name = "NAME 4", age = 20, mark = 84, mark1 = 73, mark2 = 85 });
}