I am currently implementing a grouping in my Listview. The data is getting grouped by a Datetimevalue.
I can sort the Listview by using this Datetime but then I get the long Datetimevalue inside the header I tryed using stringformat and a valueconverter but without any effect.
Is there a way to modify the output in the groupingheader?
4 Answers, 1 is accepted
You can create a custom GroupHeaderTemplate with a Label to display the text.
Now that you have you have access to the Label UIElement that renders the text, you can alter the bound text any way you see fit. One option is to use a value converter to get the exact string format you want.
I've written a demo for you, find it attached. Here's a high level look at the relevant parts of the demo:
We convert the value to a string when it's bound to the header text, so you'll need to parse it back into a DateTime object, then return the newly formatted string.
Here's a converter using the "g" DateTime string format:
Now, in your XAML, use the converter on Label's binding:
Here's a screenshot of the result at run-time:
If this is what you were looking for, you can let me know by clicking the ticket's "Mark as resolved" button. If you need further assistance, please let me know.
Lance | Tech Support Engineer, Sr.
Thanks for your support!
This was exactly what I was looking for!
You can find the documentation in RadListView Grouping (scroll down to the GroupHeaderTemplate section).
I'll talk to the development team to see if there's way to make this easier to find. Right now, we have it in the Grouping topic because that's where we would expect a developer to look for topics related to the grouping feature. However, it might be useful to have it also in the styling section.
Lance | Technical Support Engineer, Principal