This question is locked. New answers and comments are not allowed.
Hi
In my rad grid view I have the following group header template:
My converter returns string value depending on GroupViewModel
I have one problem with this approach. When rad grid view regroups himself, it doesn't call my Convert method, so I still have old headers (improper items counter or even worse improper formatted value).
How to fix it? (p.s. I need group view model as input converter value, Group/Group.Key isn't enough for me to resolve header value)
In my rad grid view I have the following group header template:
<
grid:RadGridView.GroupHeaderTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding Converter={StaticResource GroupHeaderConverter}}"
/>
</
DataTemplate
>
</
grid:RadGridView.GroupHeaderTemplate
>
My converter returns string value depending on GroupViewModel
public
class
GroupHeaderConverter : IValueConverter
{
#region IValueConverter Members
public
object
Convert(
object
value, Type targetType,
object
parameter, CultureInfo culture)
{
GroupViewModel groupViewModel = value
as
GroupViewModel;
string
formattedValue = GetFormattedValue(groupViewModel);
int
recordsCount = groupViewModel.Group.ItemCount;
return
string
.Format(
"{0} ({1} item{2})"
, formattedValue,
recordsCount, recordsCount == 1 ?
string
.Empty :
"s"
);
}
I have one problem with this approach. When rad grid view regroups himself, it doesn't call my Convert method, so I still have old headers (improper items counter or even worse improper formatted value).
How to fix it? (p.s. I need group view model as input converter value, Group/Group.Key isn't enough for me to resolve header value)