I create a custom Grid that contains 14 columns. I want all the to set the column width to the max size of the IText of the column, except for the second column.I played around with the AutoWidth.Instance, but can't make ik work.Some text is not shown properly.
The source code Optionsis attached
Please help me!
Hello Marcel,
Thank you for the provided code snippet and explanation.
If you set the text width to be with AutoWidth.Instance, the columns will be properly resized. See the attached image.
Could you please let me know what I am missing from your scenario.
Hello Zdravko,
I can reproduce what you sent to me.But what I want is this (see image)...
I want to set the column with to the max textsize of the cell except for column 2.
Thank you for the clarifications.
The AutoWidth functionality is leaving this extra space when its used by design. If you want you can set a fixed with which can be calculated based on the cell value. Below you can find a method which is returning width value based on the text and font:
..........
Although this is not recommended approach because the values within the column could be different and change its text length.
Keep in mind that if you use the fixed width, again a little extra space will be added.
I would recommend you to log it at http://ideas.infragistics.com about this functionality, the Product Ideas site allows you to suggest new product features, new functionalities in existing products and controls, and even request new controls and products altogether. Members of the Infragistics Community then vote for the features and suggestions they want to see added to the products, resulting in the most popular features bubbling up to the top. When planning new releases, our Product Management team will look at the most popular features and use your feedback to prioritize upcoming work.
Thx for your answer.
I can calculate the maximum width of the cells, before drawing the grid.Maybe that would be a solution?
I'm going to try this and let you know if it works or not and also bring my ideas to the Product Ideas site.
Marcel
Okay,
Thank you for letting me know about this. Yes, you can try this, if you will set the columns width based on the content.