var countries = new ColumnSummaryDescription();
countries.PropertyPath = "Countries";
countries.Operand = SummaryOperand.Custom;
countries.ProvideCalculator += Countries_ProvideCalculator;
this.DataGrid.SummaryDescriptions.Add(salaries);
private void Countries_ProvideCalculator(object sender, ProvideCalculatorEventArgs args)
{
args.Calculator = new CustomDomestic();
}
class CustomDomestic : SummaryCalculator
{
public int countries;
public override string DisplayName
{
get
{
return "USA";
}
}
public override void BeginCalculation(IDataSource dataSource, string propertyName)
{
base.BeginCalculation(dataSource, propertyName);
this.countries = 0;
}
public override void Aggregate(object item)
{
if(item = "USA")
{
this.countries++;
}
}
public override ISummaryResult EndCalculation()
{
return new DefaultSummaryResult(
this.PropertyName,
SummaryOperand.Custom,
this.countries);
}
}