Reputation: 115
I have a grid in which the sizes must be at the same height from the description.
private void btnAgregar_Click(object sender, EventArgs e)
{
dgvProformaDetalle.AutoGenerateColumns = false;
dgvProformaDetalle.DataSource = FillDgv();
dgvProformaDetalle.Columns["ColumnId"].DataPropertyName = "ProductoId";
dgvProformaDetalle.Columns["ColumnDescripcion"].DataPropertyName = "DescripcionProducto";
dgvProformaDetalle.Columns["ColumnTalla"].DataPropertyName = "DescripcionTalla";
}
private List<DetalleProformaExtendida> FillDgv()
{
List<DetalleProformaExtendida> listaArticulo = new List<DetalleProformaExtendida>();
DetalleProformaExtendida model = new DetalleProformaExtendida
{
ProductoId = txtIdProducto.Text,
DescripcionProducto = txtDescripcion.Text
};
listaArticulo.Add(model);
foreach (Talla item in checkedListBoxTallas.CheckedItems)
{
DetalleProformaExtendida _talla = new DetalleProformaExtendida();
_talla.TallaId = item.TallaId;
_talla.DescripcionTalla = item.Descripcion;
listaArticulo.Add(_talla);
}
return listaArticulo;
}
Upvotes: 0
Views: 55
Reputation: 54433
Maybe you want to set the ContentAlignment
of your Cells? Maybe to TopLeft
or TopRight
?
dgvProformaDetalle.Columns["ColumnDescripcion"].CellTemplate.Style.Alignment =
DataGridViewContentAlignment.TopLeft;
dgvProformaDetalle.Columns["ColumnTalla"].CellTemplate.Style.Alignment =
DataGridViewContentAlignment.TopRight;
But I am really just guessing here..
Upvotes: 1