We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Setting Multicolumn combobox''s header size

Hi, I have to 3 columns (Column A,B,C), column C is hidden. I hope to set the width of Column A and B to fit the maximum dropdownwidth of the multicolumn combobox. while hiding the column C. I''ve tried some approach but didn''t seem to work. I''ve attached the codes that i use together with the screen shots on how the result are. Thanks in advance...

5 Replies

AR Anupama Roy Syncfusion Team March 10, 2006 08:51 AM UTC

Hi Jin, Could you please upload your files once again? Thanks , Anu.


CW Chin Wye Jin March 17, 2006 04:04 AM UTC

Hi, i''m sorry for seeing this so late... Here is the screenshot...that is suppose to be with my first post

MCCB0.zip


CW Chin Wye Jin March 17, 2006 06:30 AM UTC

hi Anupama Roy, I''ve actually solve the previous post, but now i got a new problem. i''ve attached 3 pictures of the problem... The first picture is taken when my combo box drop down for the first time. Second picture is when i mouse over my mouse on the drop down grid. which the columns width only change to what i set. The last picture is what i really want my columns to be like. i''m using the codes below to do it: ------------------------------------------------ GridListControl gcontrolShift = this.mcolShiftCode.ListControl as GridListControl; gcontrolShift.Grid.PrepareViewStyleInfo += new GridPrepareViewStyleInfoEventHandler(ShiftGrid_PrepareViewStyleInfo); void ShiftGrid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if (e.RowIndex > 0 && e.ColIndex > 1) { e.Style.Format = "t"; } if (e.RowIndex == 0) { GridFontInfo fontinfo = new GridFontInfo(); fontinfo.FontStyle = FontStyle.Regular; fontinfo.Bold = false; fontinfo.Size = 8.25F; fontinfo.Unit = GraphicsUnit.Point; e.Style.Font = fontinfo; switch (e.ColIndex) { case 1: e.Style.Text = UIResx.ShopflowDataTracking.ShiftID; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 2: e.Style.Text = UIResx.ShopflowDataTracking.ShiftCode; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 3: e.Style.Text = UIResx.ShopflowDataTracking.StartTime; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 4: e.Style.Text = UIResx.ShopflowDataTracking.EndTime; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; } } } ------------------------------------------------ This problem only occurs when i have more than 2 columns in my dropdown grid. I hope the information tha i provide you sufficient... Thanks in advance.. :)

Shift.zip


AD Administrator Syncfusion Team March 17, 2006 12:20 PM UTC

Hi Jin, Calling the this.mcolShiftCode.ListBox.Grid.Invalidate(); after setting the cell column widths will solve the issue. Below is a code snippet. Lets us know if this helps. void ShiftGrid_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e) { if (e.RowIndex > 0 && e.ColIndex > 1) { e.Style.Format = "t"; } if (e.RowIndex == 0) { GridFontInfo fontinfo = new GridFontInfo(); fontinfo.FontStyle = FontStyle.Regular; fontinfo.Bold = false; fontinfo.Size = 8.25F; fontinfo.Unit = GraphicsUnit.Point; e.Style.Font = fontinfo; switch (e.ColIndex) { case 1: e.Style.Text = UIResx.ShopflowDataTracking.ShiftID; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 2: e.Style.Text = UIResx.ShopflowDataTracking.ShiftCode; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 3: e.Style.Text = UIResx.ShopflowDataTracking.StartTime; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; case 4: e.Style.Text = UIResx.ShopflowDataTracking.EndTime; e.Style.CellModel.Grid.ColWidths.SetSize(e.ColIndex, 100); break; } this.mcolShiftCode.ListBox.Grid.Invalidate(); } } Regards, Calvin.


CW Chin Wye Jin March 17, 2006 02:27 PM UTC

Thanks a lot Calvin!! It works!! :)

Loader.
Live Chat Icon For mobile
Up arrow icon