Hi,
When I used this code to display footer in my application:
It does not work as expected. Indeed, instead of having only the sum results displayed, I have all the results, as shown here:
http://img16.imageshack.us/i/capture1l.png/
But, as soon as I move the bar for the frozen columns, the footer is correctly displayed:
http://img140.imageshack.us/i/capture2e.png/
Is it a bug ? Any workaround ?
Thanks !
When I used this code to display footer in my application:
private void SetFooter() |
{ |
var columns = this._Xwg.Columns.Cast<GridViewDataColumn>().Where(c => c.DataType == typeof(double)); |
if (columns.Any()) |
{ |
foreach (var column in columns) |
{ |
column.AggregateFunctions.Add(new MaxFunction |
{ |
FunctionName = "DisplayMaxFunction", |
Caption = "Max: ", |
ResultFormatString = "{0:n}", |
SourceField = FilterSourceField(column.Header.ToString()) |
}); |
column.AggregateFunctions.Add(new MinFunction |
{ |
FunctionName = "DisplayMinFunction", |
Caption = "Min: ", |
ResultFormatString = "{0:n}", |
SourceField = FilterSourceField(column.Header.ToString()) |
}); |
column.AggregateFunctions.Add(new SumFunction |
{ |
FunctionName = "DisplaySumFunction", |
Caption = "Sum: ", |
ResultFormatString = "{0:n}", |
SourceField = FilterSourceField(column.Header.ToString()) |
}); |
column.AggregateFunctions.Add(new AverageFunction |
{ |
FunctionName = "DisplayAverageFunction", |
Caption = "Average: ", |
ResultFormatString = "{0:n}", |
SourceField = FilterSourceField(column.Header.ToString()) |
}); |
_Xwg.CalculateAggregates(); |
// Create the tooltip |
var spFunctions = new StackPanel(); |
spFunctions.Children.Add(new TextBlock { Text = string.Concat(_Xwg.AggregateResults["DisplaySumFunction"].Caption, " ", _Xwg.AggregateResults["DisplaySumFunction"].FormattedValue.ToString()) }); |
spFunctions.Children.Add(new TextBlock { Text = string.Concat(_Xwg.AggregateResults["DisplayMinFunction"].Caption, " ", _Xwg.AggregateResults["DisplayMinFunction"].FormattedValue.ToString()) }); |
spFunctions.Children.Add(new TextBlock { Text = string.Concat(_Xwg.AggregateResults["DisplayMaxFunction"].Caption, " ", _Xwg.AggregateResults["DisplayMaxFunction"].FormattedValue.ToString()) }); |
spFunctions.Children.Add(new TextBlock { Text = string.Concat(_Xwg.AggregateResults["DisplayAverageFunction"].Caption, " ", _Xwg.AggregateResults["DisplayAverageFunction"].FormattedValue.ToString()) }); |
// Create the Textblock for displaying Sum |
var tb = new TextBlock |
{ |
Text = this._Xwg.AggregateResults["DisplaySumFunction"].FormattedValue.ToString() |
}; |
// Set tooltip |
ToolTipService.SetToolTip(tb, spFunctions); |
// Set the footer |
column.Footer = tb; |
// TODO: Need to find a way to prevent frozen columns to display correct footer (Telerik bug ?) |
_Xwg.FrozenColumnCount++; |
_Xwg.FrozenColumnCount--; |
} |
} |
} |
It does not work as expected. Indeed, instead of having only the sum results displayed, I have all the results, as shown here:
http://img16.imageshack.us/i/capture1l.png/
But, as soon as I move the bar for the frozen columns, the footer is correctly displayed:
http://img140.imageshack.us/i/capture2e.png/
Is it a bug ? Any workaround ?
Thanks !