syncfusion GridControl column width not set properly - winforms

I am using the synfusion GridControl in my application.The user can select a text file and data from the file is displayed in the grid. Each and every time the grid is populated the column width is set using the code.
_gridPDD.ColWidths.SetSize(i, columnWidth);
where columnWidth will hold some fixed value based on the type of data displayed in the column.
Now the below test case works differently-
The user changes the width of the columns in the grid by dragging the edge of columns. When a new file is opened in the application and the grid is populated the columns are not shown with the default width (width set with the above line of code) instead they are set with the width of the columns in the previous section ( The width of column after the user perform a drag ).
Any help in this... Is there any property in the syncfusion GridControl that makes this behaviour? How to avoid this behaviour?

Thank you for your interest in Syncfusion products.
Your problem is the size(the width of column after the user perform a drag ) getting modified. In order to resolve this please restrict the resizing option using ResizeColsBehaviour. You may be resizing(by dragging the columns) to view the data. For that you can use AllowPropotionalColumnSizing. This allows you to resize the columns proportionately as per the data size.
Code Snippet:
//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;
Reference :
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
Please let us know if your requirement is different from this.
Thanks & Regards,
AL.Solai.

Related

Autosize grid columns as per value in grid value in extjs6

I want to autosize the grid columns to max size of the content. How do i do this. i see only autoSize function on grid column, not sure how to use it.Say column header width is more then the column data width, that should be used.
I have used autosize function, It works, but i have few issues, I have to define the align property i.e text fields will be left and number fields will be on right, then heading text gets cut. I have locked columns in all reports, locked section gives some empty spaces.
https://fiddle.sencha.com/#fiddle/1cr6
See column selling code. Its not showing full because of align: Right property. If you remove it will work.
2.After DOW column empty space is coming.
Without minWidth Property columns wont scale properly.
Take a look at this piece of documentation: Ext.grid.column.Column - Setting sizes. I don't think you can make columns scale to content. You can, however, set fixed sizes or make them flex.
I hope this helps.

WPF - overlay text on top of datagrid row

I have a WPF datagrid where certain rows will be disabled. In addition to disabling the cell contents, I'd like to present to the user some text that overlays the row with an explanation such as "Row disabled due to ...". Basically the same effect of having a label control with a lower z-order sitting directly in front of the datagrid row's cells.
If cell text spillover was possible (like in Excel), I could create a text column of 0 width with the message, then let the message runover through the neighboring cells. But to my knowledge this type of text spillover isn't possible in the datagrid.
If your rows have fixed height, you could add a another transparent datagrid on top of the other datagrid. The transparent datagrid would have one column which would show the disabled explanation. Simple but hacky solution.
The proper way would be to use adorners.

displaying data in table format without using DataGrid/ListView/Table in wpf

I need to display data in the UI in a table format. I am using wpf (MVVM), VS 2010 and windows XP. I do not want to use the DataGrid or ListView. How can I achieve this?
What I have tried
Method 1:
I tried to use SharedSizeGroup but that didn't work. The main problem with using SharedSizeGroup is that even the row height is shared among all rows.
Method 2:
I tried to use UniformGrid but I was not completely successful. Using UniformGrid will not suite my application because each column data is of different width and I do not want each column to take the same width as the Max of all!
Can anyone please tell me how to use the normal grid to get the desired result? Is there any way to use SharedSizeGroup so that only the column width is shared but not the row height and each row occupies only desired space (i.e. same behavior as setting the height to auto) but not more than that?
Additional information: This grid has to be read-only and no row should be selectable in the UI.

DevExpress MemoEdit layout issue

I want to show some text inside the MemoEdit in two columns. The parse of the text works correctly because when I see the parsed text inside Notepad or when I debug it inside Visual Studio it shows it in two columns, so the text is formatted exactly in the way I need it. The problem is that when it is shown inside the MemoEdit, it doesn't keep the format (I think this is because it uses a different font for the text, not a fixed size width font, because white spaces are smaller then normal characters). I changed the font to some fixed size width font and is showing it correctly, but the problem is that I need to have the same font like the application uses. Is there any property on MemoEdit that can help me achive the behavior I want without changing the font?
Thanks a lot!
You can activate the RowAutoHeight option of the GridView.OptionsView property in GUI and you can set it pragmatically as below:
gridView1.OptionsView.RowAutoHeight = true;
You can also use CalcRowHeight event handler to tweak the height of the gridview rows. check the reference links.
Reference these DevExpress fourm thread -
Auto-height of grid rows and text WordWrap
GridControl row height (cell height)
Changing row height at runtime

Data Grid View and Vertical scrollbars issue

I realized something annoying when using a data grid view control. When I try to set the cell's height by setting the RowTemplate height property to fit more records on the grid, the vertical scroll bar stops acting nicely and the grid doesnt display all the records (it only shows the records that fit on the available space plus one extra record!) until you resize the columns or something like that! But if I set the AutoSizeRowsMod property to AllCells the grid displays all the records, however the cell's height is now too big for me!
Is there a way to control the cell's height and still show all the records on the DGV? Does it even make sense that it's behaving this way?
Thanks

Resources