Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Try this. You should use <code>ItemsControl</code>. You will supply the template for it and it will repeated for your available data.</p> <p>XAML</p> <pre class="lang-xml prettyprint-override"><code>&lt;Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"&gt; &lt;Grid HorizontalAlignment="Center" VerticalAlignment="Center"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="32"/&gt; &lt;RowDefinition Height="*"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Left"&gt; &lt;Border BorderBrush="White" BorderThickness="1"&gt; &lt;TextBlock Text="ID" FontSize="25" Width="100"/&gt; &lt;/Border&gt; &lt;Border BorderBrush="White" BorderThickness="1"&gt; &lt;TextBlock Text="Name" FontSize="25" Width="300"/&gt; &lt;/Border&gt; &lt;Border BorderBrush="White" BorderThickness="1"&gt; &lt;TextBlock Text="Shirt Number" FontSize="25" Width="180"/&gt; &lt;/Border&gt; &lt;Border BorderBrush="White" BorderThickness="1"&gt; &lt;TextBlock Text="Position" FontSize="25" Width="180"/&gt; &lt;/Border&gt; &lt;/StackPanel&gt; &lt;ItemsControl x:Name="ic" Grid.Row="1"&gt; &lt;ItemsControl.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;Grid HorizontalAlignment="Left"&gt; &lt;StackPanel Orientation="Horizontal" HorizontalAlignment="Left"&gt; &lt;Border BorderBrush="White" BorderThickness="1"&gt; &lt;TextBlock Text="{Binding ID}" FontSize="25" Width="100"/&gt; &lt;/Border&gt; &lt;Border BorderBrush="White" BorderThickness="1"&gt; &lt;TextBlock Text="{Binding Name}" FontSize="25" Width="300"/&gt; &lt;/Border&gt; &lt;Border BorderBrush="White" BorderThickness="1"&gt; &lt;TextBlock Text="{Binding ShirtNumber}" FontSize="25" Width="180"/&gt; &lt;/Border&gt; &lt;Border BorderBrush="White" BorderThickness="1"&gt; &lt;TextBlock Text="{Binding Position}" FontSize="25" Width="180"/&gt; &lt;/Border&gt; &lt;/StackPanel&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; &lt;/ItemsControl.ItemTemplate&gt; &lt;/ItemsControl&gt; &lt;/Grid&gt; &lt;/Grid&gt; </code></pre> <p>C#</p> <pre><code>private async Task LoadXml() { StorageFolder storageFolder = Package.Current.InstalledLocation; StorageFile storageFile = await storageFolder.GetFileAsync("players2.xml"); string xml = await FileIO.ReadTextAsync(storageFile, Windows.Storage.Streams.UnicodeEncoding.Utf8); var doc = XDocument.Parse(xml); var rootNode = doc.Root; foreach (var child in rootNode.Descendants("player")) { var objPlayer = new PlayerModel { ID = child.Element("id").Value, Name = child.Element("name").Value, ShirtNumber = child.Element("shirtnumber").Value, Position = child.Element("position").Value }; Items.Add(objPlayer); } ic.ItemsSource = Items; } </code></pre> <p>PlayerModel.cs</p> <pre><code>public class PlayerModel { public string ID { get; set; } public string Name { get; set; } public string ShirtNumber { get; set; } public string Position { get; set; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload