private void UnWireEvnets(SfCellGrid cell)
 {
     if (cell != null)
     {
         cell.Model.QueryCellInfo -= Model_QueryCellInfo;
     }
 }
 internal void Gridload(int count)
 {
     tabcontrol.Items.Clear();
     Gridcollection.Clear();
     sheetvalue = 1;
     for (int i = 0; i < count; i++)
     {
         SfCellGrid cellgrid = new SfCellGrid();
         //cellgrid.Loaded += cellgrid_Loaded;
         cellgrid.RowCount                  = 1000;
         cellgrid.ColumnCount               = 1000;
         cellgrid.DefaultColumnWidth        = 64;
         cellgrid.DefaultRowHeight          = 20;
         cellgrid.Model.TableStyle.CellType = "FormulaCell";
         SfTabItem item = new SfTabItem();
         cellgrid.Name   = "Sheet" + (sheetvalue++);
         item.Content    = cellgrid;
         item.Header     = cellgrid.Name;
         item.Foreground = new SolidColorBrush(Colors.Black);
         item.FontSize   = 16;
         item.Height     = 40;
         tabcontrol.Items.Add(item);
         Gridcollection.Add(cellgrid);
     }
     tabcontrol.SelectedIndex = 0;
 }
        internal async void LoadExcel(StorageFile file)
        {
            tabcontrol.Items.Clear();
            Gridcollection.Clear();
            var       engine = new ExcelEngine();
            IWorkbook book   = await engine.Excel.Workbooks.OpenAsync(file);

            for (int i = 0; i < book.Worksheets.Count; i++)
            {
                SfCellGrid cellgrid = new SfCellGrid();
                cellgrid.RowCount                  = 1000;
                cellgrid.ColumnCount               = 1000;
                cellgrid.DefaultColumnWidth        = 64;
                cellgrid.DefaultRowHeight          = 20;
                cellgrid.Model.TableStyle.CellType = "FormulaCell";
                ExcelImportExtension.ImportFromExcel(cellgrid, book.Worksheets[i], null);
                cellgrid.RowCount    = cellgrid.RowCount < 100 ? 100 : cellgrid.RowCount;
                cellgrid.ColumnCount = cellgrid.ColumnCount < 100 ? 100 : cellgrid.ColumnCount;
                SfTabItem item = new SfTabItem();
                item.Content    = cellgrid;
                item.Header     = book.Worksheets[i].Name;
                item.Foreground = new SolidColorBrush(Colors.Black);
                item.FontSize   = 16;
                item.Height     = 40;
                tabcontrol.Items.Add(item);
                Gridcollection.Add(cellgrid);
            }
            tabcontrol.SelectedIndex = 0;
        }
        private void tabcontrol_SelectionChanged_1(object sender, Windows.UI.Xaml.Controls.SelectionChangedEventArgs e)
        {
            UnWireEvnets(_activegrid);
            var tab = sender as SfTabControl;

            if (tab.SelectedItem == null)
            {
                return;
            }
            var selected = tab.SelectedItem as SfTabItem;

            index = tab.SelectedIndex;
            if (_activegrid != selected.Content as SfCellGrid)
            {
                _activegrid = selected.Content as SfCellGrid;
                WireEvnets(_activegrid);
            }
        }
示例#5
0
 private GridColumn CreateSpreadsheetColumnExt(SfCellGrid arg)
 {
     return(new SpreadsheetColumnExt(arg as SpreadsheetGrid, this.AssociatedObject));
 }
 private void WireEvnets(SfCellGrid cell)
 {
     cell.Model.QueryCellInfo += Model_QueryCellInfo;
 }
示例#7
0
 private GridColumn CreateSpreadsheetColumnExt(SfCellGrid arg)
 {
     return(new SpreadsheetColumnExt(arg as SpreadsheetGrid, this.spreadsheet));
 }