mardi 1 septembre 2015

WPF SQLite Datagrid grouping

I have some information Binding from SQLite local database and want to show on a Data Grid and group on one of the field

<Grid>
  <DataGrid x:Name="elGrid" HorizontalAlignment="Left" VerticalAlignment="Top"
      Height="356" Width="272" Margin="29,31,0,0" AutoGenerateColumns="True"
      ItemsSource="{Binding}">
  </DataGrid>
</Grid>

Here is the .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

Aucun commentaire:

Enregistrer un commentaire