Answer»
- The columns can be manually defined by using the property AutoGenerateColumns and change that property to False.
- The columns need to be defined in the columns collection and in the data grid area.
The program that will make the columns is:
DataGridCheckBoxColumn // to define the boolean values DataGridComboBoxColumn // to define the enumerable values DataGridHyperlinkColumn // to define the Uri values DataGridTemplateColumn // to define the types of data for the cell template DataGridTextColumn // to define TEXT values <DataGrid ItemsSource="{Binding_Products}" AutoGenerateColumns="False" > <DataGrid.Columns> <DataGridTemplateColumn HEADER="Image" Width="SizeToCells" IsReadOnly="True"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Image Source="{Binding_Image}" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> </DataGrid.Columns> </DataGrid> The program that will make the columns is: DataGridCheckBoxColumn // to define the boolean values DataGridComboBoxColumn // to define the enumerable values DataGridHyperlinkColumn // to define the Uri values DataGridTemplateColumn // to define the types of data for the cell template DataGridTextColumn // to define text values <DataGrid ItemsSource="{Binding_Products}" AutoGenerateColumns="False" > <DataGrid.Columns> <DataGridTemplateColumn Header="Image" Width="SizeToCells" IsReadOnly="True"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <Image Source="{Binding_Image}" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> </DataGrid.Columns> </DataGrid>
|