syncfusion GridControl 列宽设置不正确

syncfusion GridControl column width not set properly

我在 application.The 用户中使用 synfusion GridControl 可以 select 文本文件,文件中的数据显示在网格中。每次填充网格时,都会使用代码设置列宽。

_gridPDD.ColWidths.SetSize(i, columnWidth);

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

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

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

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

感谢您对 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.