<telerik:RadGridView.GroupHeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal"
VerticalAlignment="Center">
................................
<TextBlock Name="groupTotal" Text="{Binding AggregateResults[0].Value, BindsDirectlyToSource=True,
StringFormat=Total: \{0:c\}}"
FontSize="12"
Foreground="DarkViolet"/>
<TextBlock Name="txtSpacer9"
Text=" "
VerticalAlignment="Center"/>
<TextBlock Name =" groupApproved" Text="{Binding AggregateResults[1].Value, BindsDirectlyToSource=True,
StringFormat=Approved: \{0:c\}}"
FontSize="12"
Foreground="Green"/>
</StackPanel>
</DataTemplate>
</telerik:RadGridView.GroupHeaderTemplate>
I create aggregate functions in this method:private void AddAggregateFunctions()
{
var aggregateFunction = new AggregateFunction<EmployeeExpenseReimbursementObject, double>{};
Func<EmployeeExpenseReimbursementObject, bool> argument =
obj => obj.CorpApprovalStatusID == 5 || obj.CorpApprovalStatusID == 8;
////////////////////Miles///////////////////////////////////////////////////////////////////////////
aggregateFunction = new AggregateFunction<EmployeeExpenseReimbursementObject, double>
{
AggregationExpression = approvedItems =>
approvedItems.Where(argument).Sum(c => c.Miles.ExpenseSubmittedTotal.Value),
Caption = "Approved: ",
ResultFormatString = "{0:c}"
};
gvExpenses.Columns["MilesExpense"].AggregateFunctions.Add(aggregateFunction);
}
and then call it in the window constructor:
AddGgregateFunctions();
Please help me understand what's wrong! I urgently need this working properly!
12 Answers, 1 is accepted
Can you post more info about the grid version?
All the best,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

I'm using RadGridView control (Rad Controls for Silverlight, Q1 2011 SP1).
Please advise, how could I resolve this issue. The grid is working wonderfully otherwise, and I just need to get this issue fixed ASAP.
Thanks,
Eugene
Could you upgrade to our current official release - Q2 2012 SP1 ? Do you still get the same behavior ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

We will investigate the case and try to provide an appropriate workaround or a fix. We will let you know once we have more information on the topic.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
We are going to fix this for our further versions . However you said you are using an older version so you can not benefit from a fix:
Here is a small workaround I have tested and found working for your case:
Instead of binding to the AggregateResults in the context , you can fetch them from the parent group :
Such as :
<
telerik:RadGridView.GroupHeaderTemplate
>
<
DataTemplate
>
<
StackPanel
Orientation
=
"Horizontal"
>
<
TextBlock
Text
=
"{Binding AggregateResults[0].Value, RelativeSource={RelativeSource AncestorType=telerik:GridViewGroupRow}}"
FontSize
=
"12"
Foreground
=
"DarkViolet"
/>
</
StackPanel
>
</
DataTemplate
>
</
telerik:RadGridView.GroupHeaderTemplate
>
Kind regards,
Pavel Pavlov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

I just upgraded to the trial version of Q3 2012 and it seems like the problem is gone. However, I observe another funny behavior that intereferes with my attempts to finalize the application.
Now, I load the RadGridView, where the group headers have a TextBlock with a name and four checkboxes. Depending on the value of the field in the row business object, chekboxes may be checked or unchecked. If L1 checkbox is checked, the name textbox is green (see attached step 1.jpg, name's Donellan, Paul).
When I expand a group above (Patterson, Barbara), the grid extends down and becomes scrollable. If I scroll down to see Donellan group rows, the group header still has checkboxes correctly checked and the text is green. However, if I collapse the group for Patterson, the Donellan group is no longer green and checkboxes are unchecked, and the group header down below for Bell, Tracy has green text and checked checkboxes, which is wrong. If I reload the page, it is normal again.
So, somehow, when I scroll the grid while a group is extended, the text name and checkbox values travel to another group header. This is similar to previously seen problem with aggregate values, but now group header row controls are involved. Please help me ASAP, as I urgently need to complete this app and I'm considering buying the Q3 2012 version.
Here's the code that colors the name text block and checks the checkboxes in the group header:
private void txtGroupKey_Loaded(object sender, RoutedEventArgs e)
{
TextBlock txtGroupKey = sender as TextBlock;
GridViewGroupRow row = txtGroupKey.GetVisualParent<GridViewGroupRow>();
if (row != null && row.Group.ItemCount > 0)
{
foreach (AdminExpenseListObject obj in row.Group.Items)
{
if (obj.L1ApprovalStatusID == 5)
{
SolidColorBrush brush = new SolidColorBrush(Colors.Green);
FontWeight weight = FontWeights.Bold;
txtGroupKey.Foreground = brush;
txtGroupKey.FontWeight = weight;
break;
}
}
}
}private void chkL1All_Loaded(object sender, RoutedEventArgs e)
{
CheckBox chk = sender as CheckBox;
GridViewGroupRow row = chk.GetVisualParent<GridViewGroupRow>();
chk.IsChecked = true;
chk.BorderThickness = new Thickness(2.0);
//Prevent using if not L1
if (!WebContext.Current.User.Roles.Contains("Level 1 Supervisor"))
{
chk.IsEnabled = false;
}
ToolTipService.SetToolTip(chk, "Withdraw L1 approval for ALL expenses");
if (row != null && row.Group.ItemCount > 0)
{
foreach (AdminExpenseListObject obj in row.Group.Items)
{
//Prevent approval of a non-submitted report
if (obj.EmployeeExpenseProcessingStatusID < 3)
{
chk.IsChecked = false;
chk.IsEnabled = false;
ToolTipService.SetToolTip(chk, "This expense report has not been submitted. Approval cannot be done.");
break;
}
else if (obj.L1ApprovalStatusID == 4)
{
chk.IsChecked = false;
ToolTipService.SetToolTip(chk, "Approve ALL expenses");
break;
}
else if (obj.L1ApprovalStatusID == 9)
{
chk.IsChecked = false;
ToolTipService.SetToolTip(chk, "Approval not required");
chk.IsEnabled = false;
break;
}
}
}
}
Thanks a lot
By default RadGridView has scroll virtualization turned on. This means containers ( including group rows ) are being recycled and reused.
You can solve the problem by either turning the virtualization off or by binding the values instead of setting them in the loaded events of your controls.
Greetings,
Pavel Pavlov
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

How do I turn off scroll virtualization?
Thanks

I disabled EnableRowVirtualization and EnableColumnVirtualization, and the problem is gone if I expand one group, but it's still there if I expand two groups - then the coloring of the text in the froup header still migrates to the other group header.
How can I best set up text color by binding? My task is to set the text color in the group header green if at least one business object for any row in the group has certain value. How do I best set up group header check box IsChecked status by binding depending on the values of row business objects?
Thanks a lot

<telerik:RadGridView.GroupHeaderTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Name="txtGroupKey" Text="{Binding Group.Key}"
How would you suggest to add conditional styling (changing text color depending on the values in group rows) ?
Thanks
You can check this demo for more info about conditional styling of group rows.
Greetings,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.