private void AddCustomContextMenuItem() { DelegateCommand highlightCommand = null; Action <object> highlightCommandAction = new Action <object>((parameter) => { this.radSpreadsheet.ActiveWorksheetEditor.Selection.Cells.SetFill(highlightFill); highlightCommand.InvalidateCanExecute(); }); Predicate <object> highlightCommandPredicate = new Predicate <object>((obj) => { RadWorksheetEditor editor = this.radSpreadsheet.ActiveWorksheetEditor; if (editor != null) { PatternFill patternFill = editor.Worksheet.Cells[editor.Selection.ActiveRange.SelectedCellRange].GetFill().Value as PatternFill; if (patternFill != null) { return(!patternFill.Equals(highlightFill)); } } return(false); }); highlightCommand = new SelectionDependentCommand(this.radSpreadsheet, highlightCommandAction, highlightCommandPredicate); RadMenuItem newItem = new RadMenuItem(); newItem.Header = ContextMenuItemHeader; newItem.Command = highlightCommand; this.radSpreadsheet.WorksheetEditorContextMenu.Items.Add(newItem); }
private void FreezePanesUnfreezePanes() { #region radspreadsheet-ui-freez-panes_02 RadWorksheetEditor worksheetEditor = radSpreadsheet.ActiveWorksheetEditor; worksheetEditor.UnfreezePanes(); #endregion }
private void FreezePanesRight() { #region radspreadsheet-ui-freez-panes_01 RadWorksheetEditor worksheetEditor = radSpreadsheet.ActiveWorksheetEditor; worksheetEditor.FreezePanes(new CellIndex(4, 1)); #endregion }
private void RadSpreadsheetActiveSheetEditorChanged(object sender, EventArgs e) { if (this.worksheetEditor != null) { this.worksheetEditor.Selection.SelectionChanged -= this.Selection_SelectionChanged; } this.worksheetEditor = this.radSpreadsheet.ActiveWorksheetEditor; if (this.worksheetEditor != null) { this.worksheetEditor.Selection.SelectionChanged += this.Selection_SelectionChanged; } }
private void RadSpreadsheet_ActiveSheetEditorChanged(object sender, EventArgs e) { if (this.worksheetEditor != null) { this.DetachToWorksheetEditorEvent(); } this.worksheetEditor = this.radSpreadsheet.ActiveWorksheetEditor; if (this.worksheetEditor != null) { this.AttachToWorksheetEditorEvent(); } }
private void RadSpreadsheet_ActiveSheetEditorChanged(object sender, EventArgs e) { if(this.worksheetEditor != null) { this.worksheetEditor.Selection.ActiveCellModeChanged -= this.Selection_ActiveCellModeChanged; if (this.worksheetEditor.Worksheet != null) { this.worksheetEditor.Worksheet.IsProtectedChanged -= this.Worksheet_IsProtectedChanged; } } this.worksheetEditor = this.radSpreadsheet.ActiveWorksheetEditor; if (this.worksheetEditor != null) { this.worksheetEditor.Selection.ActiveCellModeChanged += this.Selection_ActiveCellModeChanged; if (this.worksheetEditor.Worksheet != null) { this.worksheetEditor.Worksheet.IsProtectedChanged += this.Worksheet_IsProtectedChanged; } } }