private void AssciatedObject_ModelLoaded(object sender, EventArgs e)
        {
            this.AssociatedObject.InternalGrid.QueryCoveredRange += new GridQueryCoveredRangeEventHandler(QueryCoveredRange);
            this.AssociatedObject.InternalGrid.QueryCellInfo     += new GridQueryCellInfoEventHandler(QyeryCellInfo);
            //this.AssociatedObject.InternalGrid.CommitCellInfo += new GridCommitCellInfoEventHandler(CommitCell);
            this.AssociatedObject.InternalGrid.CurrentCellValidating += new CurrentCellValidatingEventHandler(CellValidating);

            this.AssociatedObject.InternalGrid.Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell;
            this.AssociatedObject.InternalGrid.Model.Options.ShowErrorIconOnEditing      = true;
            GridTooltipService.SetShowTooltips(this.AssociatedObject.InternalGrid, true);
            GridCommentService.SetShowComment(this.AssociatedObject.InternalGrid, true);



            //this.AssociatedObject.InternalGrid.Model.SaveCellText += new GridCellTextEventHandler(Savetext);
        }
Пример #2
0
        public void LoadWorkbook(IWorkbook Workbook)
        {
            tControl.Items.Clear();
            gridModelCollection = GridModelImportExtensions.ImportFromExcelToVirtualGrid(Workbook);
            for (int i = 0; i < Workbook.Worksheets.Count; i++)
            {
                GridControl grid = new GridControl();
                grid.Model = GridModelCollection[i];
                grid.Model.ColumnWidths[0]                 = 35d;
                grid.Model.Options.WrapCell                = false;
                grid.Model.Options.EnableFloatingCell      = true;
                grid.Model.Options.ExcelLikeFreezePane     = true;
                grid.Model.Options.ExcelLikeCurrentCell    = true;
                grid.Model.Options.AllowExcelLikeResizing  = true;
                grid.Model.Options.ExcelLikeSelectionFrame = true;

                grid.Model.CellModels.Add("SparkLineCell", new SparklineCellModel());
                grid.Model.GraphicModel.CellModels.Add("Chart", new GraphicChartCellModel());

                grid.Model.TableStyle.TextWrapping             = TextWrapping.NoWrap;
                grid.Model.TableStyle.FloatCellMode            = GridFloatCellsMode.OnDemandCalculation;
                grid.Model.Options.ActivateCurrentCellBehavior = GridCellActivateAction.DblClickOnCell;
                grid.Model.Options.CopyPasteOption             = CopyPaste.CopyText | CopyPaste.CutText | CopyPaste.PasteText;
                GridCommentService.SetShowComment(grid, true);
                BehaviorCollection GridBehaviors = Interaction.GetBehaviors(grid);
                GridBehaviors.Add(new GridCellImportingBehavior());
                GridBehaviors.Add(new GridCellExportingBehavior());
                GridBehaviors.Add(new CurrentCellEditingBehavior());
                GridBehaviors.Add(new CellRequestNavigateBehavior());
                GridBehaviors.Add(new CurrentCellSyncBehavior());
                TabItemExt tab = new TabItemExt();
                tab.Header = Workbook.Worksheets[i].Name;
                ScrollViewer sv = new ScrollViewer();
                sv.CanContentScroll = true;
                sv.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
                sv.VerticalScrollBarVisibility   = ScrollBarVisibility.Auto;
                sv.Content  = grid;
                tab.Content = sv;
                if (Workbook.Worksheets[i].Visibility != WorksheetVisibility.Visible)
                {
                    tab.Visibility = System.Windows.Visibility.Collapsed;
                }
                tControl.Items.Add(tab);
            }
            tControl.SelectedIndex = 0;
        }