Is it possible to have a progress bar in a cell and also show a numeric value in the cell as well. Numeric value would be in the centre of the cell and the progress bar would fill the cell when set at 100%, initial value, and move from right to left as the value decreases.
For example, we have two columns; target quantity and quantity remaining. Target quantity column would just show the numeric value. The quantity remaining column would show the numeric value and a progress bar that showed the %'age of how much was remaining with regard to the target quantity. So if target quantity was 200 and quantity remaining was 100 I'd like to see 200 in the target quantity column, 100 in the quantity remaining column and a progress bar with a value of 50% also in the quantity remaining column.
Thanks
Jim
Hello Jim,
In order to achieve your requirement on this matter, I would recommend usage of a TemplateColumn in your XamGrid. You can read about TemplateColumns in our online documentation article here: http://help.infragistics.com/Help/Doc/WPF/2016.1/CLR4.0/html/xamGrid_Create_a_Template_Column.html.
Usage of the template column will allow you to place a StackPanel with a TextBlock and a ProgressBar, which you can then bind to the properties existing on your underlying data item. If you do the calculation of the percentage remaining as a readonly property, you can then bind your ProgressBar to it, by using a procedure much like the bindings shown in the documentation article above.
I have attached a sample project that demonstrates how this could be achieved. One thing to note, is that the ProgressBar generally shows the percent complete of something, and so to get the percentage remaining, I sent the value through a converter, and you can now see the percentage remaining as a tooltip on the progress bar in the sample project, whereas the progress bar itself is an accurate representation of the percent complete.
I hope this helps you. Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Andrew,
Thanks for that, it's very close to what I need. Is there an easy way to overlay the numeric value over the progress bar rather then having them side by side? What i'm trying to achieve is similar to the 'units in stock' field in this example:-
http://help.infragistics.com/Help/Doc/WPF/2015.2/CLR4.0/html/xamGrid_Conditional_Formatting.html
But from my understanding this only works with the value displayed. In my case I need the display value and the data/progress bar top work off different values form the database.
All sorted now, thanks for your help.
Thank you for your update. I am glad that you were able to resolve this issue and that I was able to assist you on this matter.
Please let me know if you have any other questions or concerns.