Exemplo n.º 1
0
        void GridViewOnCustomSummaryCalculate(object sender, CustomSummaryEventArgs e)
        {
            var item = ((GridColumnSummaryItem)e.Item);

            if (item.Tag is IModelGridViewRuleCustomSummaryCalculate rule)
            {
                var ruleCollector = new RuleCollector(View.Model);
                var customSummaryCalculateEvent = ruleCollector.CreateInstance <ICustomSummaryCalculateEvent>(Frame, rule.Controller);
                if (e.SummaryProcess == CustomSummaryProcess.Calculate && !CriteriaOperator.Parse(rule.Criteria).Fit(((GridView)sender).GetRow(e.RowHandle)))
                {
                    return;
                }
                customSummaryCalculateEvent.Calculate(e);
            }
        }
Exemplo n.º 2
0
        private void GridViewOnPopupMenuShowing(object sender, PopupMenuShowingEventArgs e)
        {
            if (e.MenuType != GridMenuType.Summary)
            {
                return;
            }
            var ruleCollector = new RuleCollector(View.Model);

            foreach (var modelGridViewRule in ruleCollector.GetCustomSummeryCalculateRules(e.HitInfo.Column.PropertyName()))
            {
                var footerMenu = ((GridViewFooterMenu)e.Menu);
                var menuItem   = NewDXMenuItem(sender, e, modelGridViewRule);
                foreach (DXMenuItem item in footerMenu.Items)
                {
                    item.Enabled = true;
                }
                footerMenu.Items.Add(menuItem);
            }
        }