大家好,我想在Windows Phone 8.1中创建这样的GridView 1.GridView不支持AutoGenerateColumns
这是我得到的出路。在这里,我试图从Sqlite获取数据并绑定到cs文件的gridview load事件中gridview的ItemsSource属性。
My code:
<Grid Grid.Row="1" x:Name="ContentRoot" Margin="19,9.5,19,0">
<GridView x:Name="grdUser" HorizontalAlignment="Left" Height="auto" VerticalAlignment="Top" Width="auto" Loaded="grdUser_Loaded">
<GridView.HeaderTemplate><DataTemplate>
<Border Margin="5" BorderBrush="White" BorderThickness="1"><Grid ><Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
<TextBlock Text="UserName" />
<TextBlock Text="UserPassword" Grid.Column="1"/>
<TextBlock Text="CreatedDate" Grid.Column="2"/>
</Grid></Border> </DataTemplate></GridView.HeaderTemplate><GridView.ItemTemplate>
<DataTemplate>
<Border Margin="5" BorderBrush="White" BorderThickness="1"><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/><ColumnDefinition Width="Auto"/></Grid.ColumnDefinitions>
<TextBlock x:Name="tbUserName" Text="{Binding UserName}"/>
<TextBlock x:Name="tbUserPassword" Text="{Binding UserPassword}" Grid.Column="1"/>
<TextBlock x:Name="tbCreatedDate" Text="{Binding CreationDate}" Grid.Column="2"/>
</Grid></Border></DataTemplate></GridView.ItemTemplate></GridView> </Grid>
是否有任何其他控制要求。
答案 0 :(得分:0)
看看MyToolkit库,它有一个数据网格控件,可以帮到你。