Query:
What is the proper way of aligning the display member in combobox on the GridGroupingControl on the left and the amount column to the right?
|
Solution 1:
We do not have the direct support to right align the drop down list of the combox. But you can achieve your scenario by using the TableModel. EnableGridListControlInComboBox, TableModel.EnableLegacyStyle property and handling the QueryCellInfo event for GridListControl. Please refer the below code snippet and refer the attached sample,
Code snippet:
this.gridGroupingControl1.TableModel.EnableGridListControlInComboBox = true;
this.gridGroupingControl1.TableModel.EnableLegacyStyle = false;
GridDropDownGridListControlCellRenderer ren= (this.gridGroupingControl1.TableControl.CellRenderers["ComboBox"] as GridDropDownGridListControlCellRenderer) ;
control = (ren.ListControlPart as GridListControl);
control.Grid.QueryCellInfo += Grid_QueryCellInfo;
void Grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
e.Style.HorizontalAlignment = GridHorizontalAlignment.Right;
e.Style.Format = "#,###.##";
}
|
Solution 2:
You can achieve your scenario by using the GridListControl instead of ComboBox CellType. Please refer the below code snippet,
Code snippet:
this.gridGroupingControl1.TableDescriptor.Columns[3].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.GridListControl;
GridDropDownGridListControlCellRenderer ren= (this.gridGroupingControl1.TableControl.CellRenderers["GridListControl"] as GridDropDownGridListControlCellRenderer) ;
control = (ren.ListControlPart as GridListControl);
control.Grid.QueryCellInfo += Grid_QueryCellInfo;
|