Normal 0 21 false false false DE X-NONE X-NONE MicrosoftInternetExplorer4
Hello,
I am setting a hierarchical binding list as data source to my grid. After data binding, the first column cannot be resized. See my following code and screen hot. The problem is the sub binding list. Without the sub binding list all works fine. Setting the column width was ignored from the grid.
public Form1()
{
InitializeComponent();
ultraGrid1.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.None;
ultraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect;
BindingList<DocumentInfo> documentInfoList = new BindingList<DocumentInfo>();
DocumentInfo documentInfo = new DocumentInfo();
documentInfo.Identifier = "123";
documentInfo.Name = "First";
documentInfoList.Add(documentInfo);
ultraGrid1.DataSource = documentInfoList;
ultraGrid1.DataBind();
ultraGrid1.DisplayLayout.Bands[0].Columns["Identifier"].Width = 200;
}
private class DocumentInfo
private string mIdentifier;
public string Identifier
get { return mIdentifier; }
set { mIdentifier = value; }
private string mName;
public string Name
get { return mName; }
set { mName = value; }
private BindingList<DocumentInfo> mSubDocumentList;
public BindingList<DocumentInfo> SubDocumentList
get { return mSubDocumentList; }
set { mSubDocumentList = value; }
Hi,
I made the following changes to your code and I am able to change the size programmatically. When I comment the code in the InitializeLayout event, I am also able to manually resize the column:
private void Form1_Load(object sender, EventArgs e) { //ultraGrid1.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.None; ultraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect; BindingList<DocumentInfo> documentInfoList = new BindingList<DocumentInfo>(); DocumentInfo documentInfo = new DocumentInfo(); documentInfo.Identifier = "123"; documentInfo.Name = "First"; documentInfoList.Add(documentInfo); ultraGrid1.DataSource = documentInfoList; //ultraGrid1.DataBind(); //ultraGrid1.DisplayLayout.Bands[0].Columns["Identifier"].Width = 200; } private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { e.Layout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ResizeAllColumns; e.Layout.Bands[0].Columns["Identifier"].MinWidth = 100; e.Layout.Bands[0].Columns["Identifier"].MaxWidth = 100; e.Layout.Bands[0].Columns["Identifier"].Width = 100; } }
I have the same problem. I tried your solution and it does work, however -- I want the two bands to have synchronized sizing. This is disabled by the ResizeAllColumns you are doing which appears to fix the issue. If I try to manually add that feature in InitializeLayout with...
e.Layout.Override.AllowColSizing = Infragistics.Win.UltraWinGrid.AllowColSizing.Synchronized;
It goes back to one super wide first column that cannot be resized. What gives?