WPF SQLite Datagrid分组

时间:2015-09-02 02:38:05

标签: wpf vb.net sqlite datagrid

我有一些信息从SQLite本地数据库绑定 并希望在其中一个字段

上显示数据网格和组
<Grid>
  <DataGrid x:Name="elGrid" HorizontalAlignment="Left" VerticalAlignment="Top"
      Height="356" Width="272" Margin="29,31,0,0" AutoGenerateColumns="True"
      ItemsSource="{Binding}">
  </DataGrid>
</Grid>

这是.xmla.vb

Private Sub loadData()
    Dim a As String = ""
    SetConn()
    sql_con.Open()
    Dim CommandText As String = "select Cname,CMid from conn"
    db = New SQLiteDataAdapter(CommandText, sql_con)
    db.Fill(dt)
    a = dt.Rows.Count.ToString

    elGrid.DataContext = dt

    sql_con.Close()
End Sub

1 个答案:

答案 0 :(得分:0)

让我们看看是否正确

MODELO    CONNECTOR       PIN
  1         A01           01
                          02
            A02           01
  2         B01           01
            B02           01
                          02