<Page
x:Class="Studentt1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Studentt1"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="Wheat">
<ListBox x:Name="listBox1" ItemsSource="{Binding StudentsList}"
SelectedItem="Binding SelectedStud,Mode=TwoWay}"
DisplayMemberPath="StudName"
HorizontalAlignment="Left" Height="332" Margin="59,173,0,0" VerticalAlignment="Top"
<Button Content="Load" Command="{Binding LoadCommand}" HorizontalAlignment="Left"
Margin="144,567,0,0" VerticalAlignment="Top"/>
<Grid Background="Brown" HorizontalAlignment="Left" Height="352"
VerticalAlignment="Top" Width="633">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="347"/>
<ColumnDefinition Width="401"/>
<ColumnDefinition Width="367*"/>
<ColumnDefinition Width="251*"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" FontSize="30" Grid.Column="0" Text="Registration
Number" HorizontalAlignment="Center" Margin="46,0,25,0" Width="276"/>
<TextBox Grid.Row="0" Grid.Column="1" Text="{Binding
ElementName=listBox1,Path=SelectedItem.RegNo,Mode=TwoWay}"/>
<TextBlock Grid.Row="1" Grid.Column="0" FontSize="30" Text="Name"
HorizontalAlignment="Center" Margin="144,0,124,0" Width="79"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding
ElementName=listBox1,Path=SelectedItem.StudName,Mode=TwoWay}"/>
<TextBlock Grid.Row="2" Grid.Column="0" FontSize="30" Text="Age"
HorizontalAlignment="Center" Margin="157,0,137,0" Width="53"/>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding
ElementName=listBox1,Path=SelectedItem.Age,Mode=TwoWay}"/>
</Grid>
</Grid>
</Page>
在這裏,我綁定列表框,文本框的選擇項..
你可以找到zip文件完整的源代碼
啊,太慢:( –