syncfusion GridControl列宽未正确设置

时间:2015-05-27 07:08:11

标签: winforms gridcontrol syncfusion

我在我的应用程序中使用了synfusion GridControl。用户可以选择文本文件,文件中的数据显示在网格中。每次填充网格时,使用代码设置列宽。

_gridPDD.ColWidths.SetSize(i,columnWidth);

其中columnWidth将根据列中显示的数据类型保留一些固定值。

现在,以下测试用例的工作方式不同 -

用户通过拖动列的边缘来更改网格中列的宽度。当在应用程序中打开一个新文件并填充网格时,列不会显示默认宽度(使用上面的代码行设置的宽度),而是使用上一节中的列宽度设置(宽度)用户执行拖动后的列。

这方面的任何帮助...... syncfusion GridControl中是否存在导致此行为的任何属性?如何避免这种行为?

1 个答案:

答案 0 :(得分:0)

感谢您对Syncfusion产品的兴趣。

您的问题是修改后的大小(用户执行拖动后列的宽度)。要解决此问题,请使用ResizeColsBehaviour限制调整大小选项。您可能正在调整大小(通过拖动列)来查看数据。为此,您可以使用AllowPropotionalColumnSizing。这允许您根据数据大小按比例调整列的大小。

代码段:

//to restrict the resizing option using drag
this.grid.Model.Options.ResizeColsBehavior = GridResizeCellsBehavior.None;

//to resize the columnpropotionatelt according to the column data
this.grid.AllowProportionalColumnSizing = true;

参考http://www.syncfusion.com/kb/695/how-to-prevent-column-resizing-for-child-tables-in-gridgroupingcontrol

http://www.syncfusion.com/kb/4853/how-to-optimize-the-resizetofit-method-for-large-number-of-records

如果您的要求与此不同,请告知我们。

谢谢&问候, AL.Solai。