I have a GridView which contains a name column - and the name may be null or " " or "" or a real name.
Ex:
Name1: null
Name2: " "
Name3: ""
Name4: "Obama"
Name5: "obama"
Name6: " obama" (should be grouped with Obama and not with "")
In the group header I would like to group by the names first letter - or "" if there String.IsNullOrWhiteSpace is true. And I would like the group header to ignore the case of the first letter.
There are other columns in the GridView which I do not want grouped like this.
I have done this:
GroupMemberPath="Entity.Name[0]"
But that leaves an ugly square in the header if the name is null - (and " " and "" are grouped in two different groups. So is "Obama" and "obama" and " obama").
I have a quite a few of these name-columns around in my program, so I would like an elegant, reusable solution :ΓΈ) What I really need is a way to add a Converter to the group binding.
Normally I would use a converter, but there does not seem to be a way to add a converter to the groupmemberpath (?)
There is a GroupHeaderFormatString; but I have failed to find a way to get {}{0:<something>} to return the first letter.
The type of Name is String. I really do not want to change this so adding a FirstLetter-property is not a solution either.
Seems like adding a GroupHeaderTempate will only affect the text in the group header. It will not allow me to group "Obama" and "obama" in the same group.
Is there a solution to this?
Thanks
Ex:
Name1: null
Name2: " "
Name3: ""
Name4: "Obama"
Name5: "obama"
Name6: " obama" (should be grouped with Obama and not with "")
In the group header I would like to group by the names first letter - or "" if there String.IsNullOrWhiteSpace is true. And I would like the group header to ignore the case of the first letter.
There are other columns in the GridView which I do not want grouped like this.
I have done this:
GroupMemberPath="Entity.Name[0]"
But that leaves an ugly square in the header if the name is null - (and " " and "" are grouped in two different groups. So is "Obama" and "obama" and " obama").
I have a quite a few of these name-columns around in my program, so I would like an elegant, reusable solution :ΓΈ) What I really need is a way to add a Converter to the group binding.
Normally I would use a converter, but there does not seem to be a way to add a converter to the groupmemberpath (?)
There is a GroupHeaderFormatString; but I have failed to find a way to get {}{0:<something>} to return the first letter.
The type of Name is String. I really do not want to change this so adding a FirstLetter-property is not a solution either.
Seems like adding a GroupHeaderTempate will only affect the text in the group header. It will not allow me to group "Obama" and "obama" in the same group.
Is there a solution to this?
Thanks