コード例 #1
0
        public SimpleGroupTestViewModel()
        {
            _table1 = new ReactiveTable();
            var groupColumn = new ReactiveColumn <string>(GroupColumnId);

            _table1.AddColumn(groupColumn);
            var valueColumn = new ReactiveColumn <int>(ValueColumnId);

            _table1.AddColumn(valueColumn);
//            ReactiveTable table2 = new ReactiveTable();
//            table2.AddColumn(new ReactiveColumn<string>("GroupColumn2"));
//            table2.AddColumn(new ReactiveColumn<int>("ValueColumn2"));

            _groupedTable = new AggregatedTable(_table1);
            _groupedTable.GroupBy <string>(groupColumn.ColumnId);
            _groupedTable.AddAggregate(groupColumn, CountColumnId, () => new Count <string>());
            _groupedTable.AddAggregate(valueColumn, SumColumnId, () => new Sum <int>());
            _groupedTable.AddAggregate(valueColumn, AverageColumnId, () => new Average <int>());
            _groupedTable.AddAggregate(valueColumn, MinColumnId, () => new Min <int>());
            _groupedTable.AddAggregate(valueColumn, MaxColumnId, () => new Max <int>());

            LoadDataCommand = new DelegateCommand(LoadData);
            Items           = new ObservableCollection <SimpleGroupItem>();

            _groupedTable.RowUpdates().Subscribe(OnRowUpdate);
        }