Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
560
No SummaryDefinitions Output with DataTable?
posted

Hello, i have a SummaryDefinitions put under der Presenter, when i use a IList<MyDATA> as DataSource the SummaryDefinitions works fine. But when the DataSource is a DataTable as DefaultView, there is no SummaryDefinition Output. Any idea? the columns are generated manually, Autogenerate=false.

MyData has a property MA, the DataTable also has a column with MA, where is the problem?

Parents
  • 28407
    posted

    HI,

     Try setting you AutoGenerate=true and see if your Summary shows up.

     I was able to add a summary definition to my grid without issues.

     Here is my code behind

    private void Window_Loaded(object sender, RoutedEventArgs e)
            {
                NwindDataSet nwind = new NwindDataSet();
                NwindDataSetTableAdapters.OrdersTableAdapter ord = new NwindDataSetTableAdapters.OrdersTableAdapter();
                ord.Fill(nwind.Orders);
                NwindDataSetTableAdapters.Order_DetailsTableAdapter ordd = new NwindDataSetTableAdapters.Order_DetailsTableAdapter();
                ordd.Fill(nwind.Order_Details);

                 xamDataGrid1.DataSource = nwind.Orders.DefaultView;
              //  xamDataGrid1.DataSource = nwind.Order_Details.DefaultView;
                 loadSummary();
            }

            private void loadSummary()
            {
                SummaryDefinition avecost = new SummaryDefinition();
                avecost.SourceFieldName = "UnitPrice";
                avecost.Calculator = SummaryCalculator.Average;
                xamDataGrid1.FieldLayouts[1].SummaryDefinitions.Add(avecost);

                SummaryDefinition avefreight = new SummaryDefinition();
                avefreight.SourceFieldName = "Freight";
                avefreight.Calculator = SummaryCalculator.Average;
                xamDataGrid1.FieldLayouts[0].SummaryDefinitions.Add(avefreight);

            }

    Sincerely,
     Matt
     Developer Support Engineer

Reply Children
No Data