1.

Write A Program To Manually Define The Columns In .netgrid?

Answer»
  1. The columns can be manually defined by using the property AutoGenerateColumns and change that property to False. 
  2. 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" &GT;
<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>



Discussion

No Comment Found