public void Populate(object grid, IColumnsProvider <T> provider) { //if (grid is ItemsControl dataGrid) //{ // dataGrid.SourceUpdated += delegate (object sender, DataTransferEventArgs args) // { // ICollectionView cv = CollectionViewSource.GetDefaultView(dataGrid.ItemsSource); // }; //} provider.Populate(grid); }
public override void Render() { // Receive parent data item context HierarchicalDataItem parentDataItem = GetDataContext(); _data = _isDataReceivedDirectly ? _data : _templateProcessor.GetValue(_dataSourceTemplate, parentDataItem); bool isCanceled = CallBeforeRenderMethod(); if (isCanceled) { ResultRange = ExcelHelper.CloneRange(Range); return; } IColumnsProvider columnsProvider = _columnsFactory.Create(_data); if (columnsProvider == null) { DeletePanel(this); return; } IList <ExcelDynamicColumn> columns = columnsProvider.GetColumnsList(_data); if (!columns.Any()) { DeletePanel(this); return; } ResultRange = ExcelHelper.MergeRanges(Range, RenderHeaders(columns)); ResultRange = ExcelHelper.MergeRanges(ResultRange, RenderColumnNumbers(columns)); IXLRange dataRange = RenderDataTemplates(columns); if (dataRange != null) { ResultRange = ExcelHelper.MergeRanges(ResultRange, RenderData(dataRange)); } IXLRange totalsRange = RenderTotalsTemplates(columns); if (totalsRange != null) { ResultRange = ExcelHelper.MergeRanges(ResultRange, RenderTotals(totalsRange)); } RemoveName(); CallAfterRenderMethod(); }