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
365
{System.ArgumentOutOfRangeException using SetMeasureAggregator
posted

Hi folks,

I am trying to test out using a MeasureAggregator, and am getting this exception.  Not sure why the viewModel.Measures array would be empty but it appears to be.  Thoughts?

 
        void DrillDown_Loaded(object sender, RoutedEventArgs e)
        {

            IEnumerable sampleData = SampleDataGenerator.GenerateSales(500);

            //(xamPivotGrid1.DataSource as FlatDataSource).ItemsSource = sampleData;
           
            FlatDataSource flatDataSource = new FlatDataSource()
            {
                //Data is the IEnumerable to be used as a source
                ItemsSource = sampleData,
                Cube = DataSourceBase.GenerateInitialCube("Sale"),
                Rows = DataSourceBase.GenerateInitialItems("[Date]"),
                Columns = DataSourceBase.GenerateInitialItems("[City]"),
                Measures = DataSourceBase.GenerateInitialItems("NumberOfUnits, AmountOfSale")
            };

            xamPivotGrid1.DataSource = flatDataSource;

            xamPivotDataSelector1.DataSource = flatDataSource;

            xamPivotGrid1.DataSource.Columns.CollectionChanged += new NotifyCollectionChangedEventHandler(Columns_CollectionChanged);

            IOlapViewModel viewModel = xamPivotGrid1.DataSource;

            viewModel.SetMeasureAggregator((IMeasureViewModel)viewModel.Measures[0], MeasureAggregator.Average);

            viewModel.RefreshGrid();
        }