Hello,
I am using XamGrid in infragistics 2014.1 to present some integers.
For one column I want to format the integer to be shown with 3 digits. So if integer is 4 then it should be shown as 004
and if 44 then shown as 044.
I have tried with FormatString="{}{0:000}" but it doesn't work
Below is a sample code:
<ig:XamGrid x:Name="XdtgSearchResults" HorizontalAlignment="Stretch" VerticalAlignment="Top" AutoGenerateColumns="False" Margin="0,10,10,0" > <ig:XamGrid.SelectionSettings> <ig:SelectionSettings CellClickAction="SelectRow" RowSelection="Single"/> </ig:XamGrid.SelectionSettings> <ig:XamGrid.Columns> <ig:TextColumn Key="ProductType.ProductTypeCode" HeaderText="PTCode" /> <ig:TextColumn Key="ProductCode" HeaderText="PCode" FormatString="{}{0:000}" /> <ig:TextColumn Key="SerialNumber" HeaderText="Serial number" /> </ig:XamGrid.Columns> </ig:XamGrid>
Hello Zada,
Thank you for your post.
I have been looking into the code that you have provided and I could not manage to reproduce the issue on my side. I created a sample application(FormatCellValue.zip) based on your code, would you please let me know if you can reproduce the same behavior with my sample or I am missing something?
Looking forward to hearing from you.
I am just checking your progress on the issue that you are having.
If you require any further assistance please do not hesitate to ask.
Hi Zhivko Nikolov,
Thanks for your reply.
I donwloaden and opened the solution you sent,of course it was working correct.
But in my own project it still isn't. I didn't really have time to check what is wrong, I do still get them as one digit in case it is 1.
Thank you for your feedback.
In order to be able to investigate what might be causing the issue, would you please modify my sample to show the issue or if possible provide me with application?
Hello Zhivko,
Since your solution was working and mine wasn't then I decided to find the problem.
I figured out that the data from database was in string format and not int as expected.
the second problem was that they contained white spaces. So what I was expecting to be 1 was actually "1 ".
Thank you very much for the try. At least I know that FormatString="{}{0:000}" is working.
I am very glad, that you have managed to resolve your issue.
Please let me know if you need any further assistance on this matter.
I am just checking if my last reply was helpful for you.