I am trying to format a cell with numbers to "###,###,###,###.##"
The number e.g. 335249560533 should display as 3352-4956 053-3
Using the format string "###,###,###,###.##" with MaskedEdit control works fine.
Can you give me a hint on how to this in WinGrid?
rgds
Wolfgang
Hello Wolfgang,
In order to format a cell in the UltraGrid, you can set the Format property on the UltraGridColumn. This is best done within the InitializeLayout event of the UltraGrid, which should be hooked before you set the DataSource on the grid. Once you have that, you can set your format string to the Format property like so:
private void UltraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e) { UltraGridColumn column = e.Layout.Bands[0].Columns["Number"]; column.Format = "###,###,###,###.##"; }
Please let me know if you have any other questions or concerns on this matter.
The solution is: .MaskInput = "####\-####\ ###\-#" .MaskDisplayMode = Infragistics.Win.UltraWinMaskedEdit.MaskMode.IncludeLiteralsThe InitializeLayout Event ist fired after setting the DataSource, so how should I hooked it before?Anyway, this was works.
The InitializeLayout event is only where I would personally recommend setting this, but it can be set any time after the layout is initialized. I am assuming from your question of how to hook the event beforehand is pointing to you likely hooking your data source in the designer. If this is the case, you can simply hook the event from the designer instead, and it should fire.