What I thought was going to be a simple issue, hasn't turned into one. Basically I need to autosize a column based on the contents in the dropdown.
The grid is bound to a BindingList<T> as well as the combobox column. The values that appear in the combobox (DisplayMember) are based on resources, so it's possible the width of the required column could changed based on the resource id and the string returned. I need to automatically adjust the width of the GridViewComboBoxColumn based on the contents in the combo box. Currently I'm using the <column>.BestFit() method, but this only works based on the displayed data, I've tried using the AutoSizeMode property after the call of BestFit() call as explained in help but there is nothing there that says to use width of the values in the drop down (by the way there is an error in the names of the enumerators for this setting BestFitColumnMode.SymmaryRowCells - it should be BestFitColumnMode.SummaryRowCells, but I digress)
An example, based on resourceID
en-US fr-FR es-MX
XXX XXXXXXXX XXXXXXXXXXXXXXXXXXXX
YYYYYY YYYY YYYYYY
I need the width of the column to adjust based on the max length of whatever could be displayed to the user, in the example above, if the resource id is set to es-MX, the width of the column should be larger (wider) than it is if the resourceID is en-US, and the same for fr-FR.
Hopefully I haven't over-complicated the explanation of the problem. Thank you in advance,
Dave Galligher
The grid is bound to a BindingList<T> as well as the combobox column. The values that appear in the combobox (DisplayMember) are based on resources, so it's possible the width of the required column could changed based on the resource id and the string returned. I need to automatically adjust the width of the GridViewComboBoxColumn based on the contents in the combo box. Currently I'm using the <column>.BestFit() method, but this only works based on the displayed data, I've tried using the AutoSizeMode property after the call of BestFit() call as explained in help but there is nothing there that says to use width of the values in the drop down (by the way there is an error in the names of the enumerators for this setting BestFitColumnMode.SymmaryRowCells - it should be BestFitColumnMode.SummaryRowCells, but I digress)
An example, based on resourceID
en-US fr-FR es-MX
XXX XXXXXXXX XXXXXXXXXXXXXXXXXXXX
YYYYYY YYYY YYYYYY
I need the width of the column to adjust based on the max length of whatever could be displayed to the user, in the example above, if the resource id is set to es-MX, the width of the column should be larger (wider) than it is if the resourceID is en-US, and the same for fr-FR.
Hopefully I haven't over-complicated the explanation of the problem. Thank you in advance,
Dave Galligher