Is there a way to programmatically force the Summary Row to recalulate, without calling InvalidateData()? Calling InvalidateData causes an exception when using dynamic columns, a custom operand, and in a grouping, so I need a different way. There should be feature that is a simple method on the XamWebGrid called RecalcSummaryRow.
Hi Brian,
This is a scenario we overlooked. And i agree that having a method to refresh the summary row, would definitely be valuable. So we have added it to our backlog.
However, InvalidateData shouldn't be causing an exception. If you could provide more detail about the scenario in which you're getting an exception that'd be useful, so that we can correct this problem.
Thanks,
-SteveZ
I am definitely pushing your XamWebGrid to its limits. I am using a custom TemplateColumn, TemplateColumnContentProvider, SummaryOperand, and a custom SynchornousSummaryCalculator to achive my desired results. Basically I have an object, StaffMember, that has a collection of objects called Periods, which is based off a selected time frame (from date - to date) to the n-level. Basically, I have to flatten out my object graph for editing, so I am dynamically adding columns at runtime to the n-level which are bound to index of the collection property of the bound object. Lets just say I don't think your grid was built to do some of the behaviors I require. So in my CustomTemplateContentProvider I have code like this:
public
override FrameworkElement ResolveDisplayElement(Cell cell, Binding cellBinding){
FrameworkElement elem = base.ResolveDisplayElement(cell, cellBinding);
if (elem != null){
StaffMember mdo = cell.Row.Data as StaffMember;
if (mdo != null){
elem.DataContext = mdo.Periods[(cell.Column
as MyColumn).Index];}
}
return elem;
for some reason if I call InvalidateData on the PropertyChanged of the Period Hours property, it would cause an exception. So then I tried to call it after CellExitEditMode, which worked fine if I did not have a grouping applied. If a grouping is applied and you call InvalidateData() then all the expanded grouping collapse, would is very annoying, because you would have to expand all the grouping again everytime you changed a vlue, and our users will not except that behavior. So I need another mechanism to recalculate the summary row similar to how DevExpress's AgDataGrid has Grid.RefreshSummaries. I tried doing tricks in code such as sorting a column, because if you sort a column in the UI the summaries recalculate, but nothing works. But a lot of the problems I have been having is probably due to the fact that your grid does not natively support the type of binding I am trying to do.