Hi,
I've a wingrid with a column, type numeric. In InitializeLayout-event I write 'NumCol.Format = "N0"'. But in some rows of this column I need 'Format="N2"'. Is this possible ?
I'm using Infragistics 7.3
Thanks
Hansjörg Wintermantel
OK, this works. Thanks.
OK, I was away and just saw this. Will look at and try to understand (!) and give it a try. Thanks.
I just wanted to let you know that we've looked into this in detail, and it's not a bug in the grid, it's an error in your GetFormatInfo code. You are making the assumption that the ownerContext will always be a CellUIElement. This is an understandable assumption on your part, but it's not correct. The ownerContext will be a CellUIElement only in the case where the grid is painting the cell on the screen. For other cases, like AutoSizing, the context might be something else - an UltraGridRow.
So you need to account for both possibilities.
public class MyDefaultEditorOwner : DefaultEditorOwner { public override void GetFormatInfo(object ownerContext, out string format, out IFormatProvider provider) { provider = null; // NOTE: If you change default format to "N2" everything will behave properly. // If you change it to something like "N7" the autosize behaves as though it needs 7 spaces after the decimal point string defaultFormat = "N0"; UltraGridRow row = ownerContext as UltraGridRow; if (null == row) { UIElement element = ownerContext as UIElement; if (null != element) row = element.GetContext(typeof(UltraGridRow)) as UltraGridRow; } //if (cellElement != null) //{ // UltraGridColumn column = cellElement.Column; // UltraGridRow row = cellElement.Row; // if ((row.Index % 2) == 0) // format = "N0"; // else // format = "N2"; //} if (null != row) { UltraGridColumn column = row.Band.Columns[0]; if ((row.Index % 2) == 0) format = "N0"; else format = "N2"; } else { Debug.Fail("Failed to get an UltraGridRow from the ownerContext. So we may want to account for the different ownerContext type."); format = defaultFormat; } } }
Note that I also added a Debug.Fail here, so that if the ownerContext returns something else that you are not accounting for, it will raise a message to notify you.
Hi sunibla,
I have logged this behavior in our internal tracking system with a Development ID of 143042. The next step will be for a developer to review my investigation and confirm my findings or to offer a fix or other resolution.
Thanks. Note I did try applying a format to the column, and resize did work properly, however the column format over-rode the texteditor format and all the cells then have the column format.