DgLotes.DataSource = lista_exp_lotes;
DgLotes.Columns.Clear();
DgLotes.EditorSelectionBehavior = EditorSelectionBehavior.SelectAll;
DgLotes.Columns.Add(
new GridNumericColumn()
{
MappingName = "Numero",
HeaderText = "Nº",
ValidationMode = GridValidationMode.InEdit,
NumberFormatInfo = new NumberFormatInfo() { NumberDecimalDigits = 0 },
FormatMode = FormatMode.Numeric,
MaximumWidth = 50
});
DgLotes.Columns.Add(
new GridTextColumn()
{
MappingName = "Nombre",
HeaderText = "Nombre",
ValidationMode = GridValidationMode.InEdit,
});
DgLotes.Columns.Add(
new GridTextColumn()
{
MappingName = "Descripcion",
HeaderText = "Descripcion",
ValidationMode = GridValidationMode.InEdit
});
DgLotes.Columns.Add(
new GridNumericColumn()
{
MappingName = "Importe",
HeaderText = "Importe",
ValidationMode = GridValidationMode.InEdit,
MaximumWidth = 120,
NumberFormatInfo = numberFormat
});
DgLotes.CellRenderers.Remove("ComboBox");
DgLotes.CellRenderers.Add("ComboBox", new GridComboBoxCellRendererExt());
DgLotes.Columns.Add(new GridButtonColumn()
{
HeaderText = "+",
MappingName = "UnboundColumn",
AllowFiltering = false,
AllowDefaultButtonText = true,
DefaultButtonText = "",
ImageSize = new Size(16, 16),
AutoSizeColumnsMode = AutoSizeColumnsMode.AllCells,
Image = Resources.add_161,
MaximumWidth = 30,
CellStyle = new CellStyleInfo { HorizontalAlignment = HorizontalAlignment.Center },
});
DgLotes.Columns.Add(new GridButtonColumn()
{
HeaderText = "X",
MappingName = "UnboundColumn",
AllowFiltering = false,
AllowDefaultButtonText = true,
DefaultButtonText = "",
ImageSize = new Size(16, 16),
AutoSizeColumnsMode = AutoSizeColumnsMode.AllCells,
Image = Resources.feEliminar_16,
MaximumWidth = 30,
CellStyle = new CellStyleInfo { HorizontalAlignment = HorizontalAlignment.Center },
});
GridViewDefinition firstLevelGridViewDefinition = new GridViewDefinition
{
RelationalColumn = "CodigosCPV"
};
firstLevelGridViewDefinition.DataGrid.Style.HeaderStyle.BackColor = ColorTranslator.FromHtml("#CAECCF");
SfDataGrid firstLevelNestedGrid = new SfDataGrid
{
AllowSorting = true,
AllowFiltering = true,
AllowResizingColumns = true,
AutoGenerateColumns = false,
AutoSizeColumnsMode = AutoSizeColumnsMode.AllCellsWithLastColumnFill
};
firstLevelNestedGrid.Columns.Add(new GridTextColumn() { MappingName = "Codigo", HeaderText = "Codigo",Width = 90 });
firstLevelNestedGrid.Columns.Add(new GridTextColumn() { MappingName = "Descripcion", HeaderText = "Descripcion",Width = 350 });
firstLevelGridViewDefinition.DataGrid = firstLevelNestedGrid;
DgLotes.DetailsViewDefinitions.Add(firstLevelGridViewDefinition);
DgLotes.DetailsViewExpanding += SfDataGrid_DetailsViewExpanding;