Hi
How do i set the below datagrid to have 1 text column and 1 checkbox column?
The grid is populated with the below vb.net 2010 code.
Public Sub refreshBodylist()
On Error GoTo ErrorHandler
Dim con As SqlCeConnection = New SqlCeConnection(My.Settings.myCompactDBConnectionString)
Dim sqlquery As String
sqlquery = "SELECT Bodypart, checked_fg from dBodyPart order by bodypart"
Dim cmd As New SqlCeCommand(sqlquery, con)
daBodyPart = New SqlCeDataAdapter(cmd)
Dim clienttable As New DataTable()
clienttable.Locale = System.Globalization.CultureInfo.InvariantCulture
Me.daBodyPart.Fill(clienttable)
Me.bindingSource3.DataSource = clienttable
XamGrid1.ItemsSource = bindingSource3
Exit Sub
ErrorHandler:
Dim errMessage As String = "Error Description: " & Err.Description & ". Error Source: " & Err.Source & "."
Dim errCaption As String = "Error"
Dim errButtons As Integer = MessageBoxButton.OK
MessageBox.Show(Me, errMessage, errCaption, errButtons)
If con.State = ConnectionState.Open Then
con.Close()
End If
End Sub
Xaml
<ig:XamGrid HorizontalAlignment="Left" Margin="501,76,0,0" Name="XamGrid1" VerticalAlignment="Top" Height="188" Width="97" ColumnLayoutHeaderVisibility="Never">
<ig:XamGrid.RowSelectorSettings>
<ig:RowSelectorSettings Visibility="Hidden" EnableRowNumbering="False" />
</ig:XamGrid.RowSelectorSettings>
<ig:XamGrid.EditingSettings>
<ig:EditingSettings IsF2EditingEnabled="False" />
</ig:XamGrid.EditingSettings>
<ig:XamGrid.ColumnChooserSettings>
<ig:ColumnChooserSettings AllowColumnMoving="False" />
</ig:XamGrid.ColumnChooserSettings>
<ig:XamGrid.SelectionSettings>
<ig:SelectionSettings CellSelection="Single" RenderOptions.ClearTypeHint="Enabled" />
</ig:XamGrid.SelectionSettings>
</ig:XamGrid>
Hello,
If the column "checked_fg" is holding boolean type, the xamGrid should display the CheckBoxColumn as it matches the column types with corresponding field types. Try defining the CheckBoxColumn in XAML such as: <ig:CheckBoxColumn Key="checked_fg" />
For more information about column types see the Columns topic in XamGrid.
Sam