I have a List of string. e.g. "abc", "pqr", "xyz" in this order. A StackPanel is data bound to this list. I want to display the list in a StackPanel vertically but in reverse order from top to bottom
"xyz"
"pqr"
"abc"
Is there a way to do this in xaml or do I have to reorder my list?
Yes and No, the StackPanel
will display them in the order in which they are enumerated. So you have a couple of options as I see it:
1) Re-order your list
2) Change your binding, or apply a IValueConverter
that does the re-order on the fly. This of course requires coding the converter, but once it's written you can re-use it in your XAML as required without having to modify individual windows, code-behinds, etc.