Coordinates worksheet-tab selection, scrolling, and sheet-management interactions for a spreadsheet.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.RadSpreadsheet.dll
Syntax:
public class RadSpreadsheetSheetSelector : LightVisualElement, INotifyPropertyChanged, ICustomTypeDescriptor, ISupportSystemSkin, IBindableComponent, IComponent, IDisposable, ISupportDrag, ISupportDrop, IShortcutProvider, IStylableElement, IStylableNode, IPrimitiveElement, IShapedElement, IFillElement, IBorderElement, IBoxStyle, IBoxElement, IDrawFillElement, IImageElement, ITextPrimitive, ITextProvider
Inheritance: objectDisposableObjectRadObjectRadElementVisualElementRadComponentElementRadItemUIItemBaseLightVisualElementRadSpreadsheetSheetSelector...
Implements:
Inherited Members
Constructors
Initializes the worksheet selector and its tab-navigation commands.
public RadSpreadsheetSheetSelector()
Fields
Indicates whether a left-button drag of the sheet-selector divider is in progress.
protected bool draggingGrip
Stores the pointer location at which the current divider drag began.
protected Point mouseDownPosition
Stores the divider's relative position at the beginning of the current drag.
protected float startGripRatio
Properties
Gets the editor for the active worksheet; the selector updates its selection-change subscription when this editor changes.
public RadWorksheetEditor ActiveWorksheetEditor { get; }
public bool EnableScrollingAnimation { get; set; }
Gets or sets whether a new-sheet tab is included when the selector builds its tab items. Changing this value does not rebuild the existing tab items.
public bool IsAddButtonVisible { get; set; }
Gets whether the active sheet tab is currently being renamed.
public bool IsInEditMode { get; }
Gets the command that converts its parameter to a proposed active-sheet name and applies it when valid and unique. Invalid or duplicate names trigger an alert instead of changing the sheet name.
public ICommand RenameSheetCommand { get; }
The command is disabled while the associated workbook is protected.
Gets the animation settings used when the sheet-tab scroll offset changes.
public AnimatedPropertySetting ScrollAnimation { get; }
Gets the horizontal scrollbar element arranged beneath the sheet tabs.
public RadScrollBarElement ScrollBar { get; }
Gets the scroll offset applied to the sheet tabs.
[Browsable(false)]
public int ScrollOffset { get; }
Gets the spreadsheet element whose workbook and active editor supply the selector's sheet state.
public RadSpreadsheetElement SpreadsheetElement { get; }
Methods
Creates and registers the add-sheet tab; its mouse-up handler adds and activates a worksheet only when sheet changes are allowed and the current cell edit can be committed.
protected virtual void AddInsertSheetTabItem()
Subscribes to the active editor's selection-changing event so a failed sheet rename can cancel the pending selection change.
protected virtual void AttachToActiveWorksheetEditorEventsEvents()
Subscribes to sheet-collection and active-sheet changes so the tab list and active tab stay synchronized.
protected virtual void AttachToSheetsCollectionEvents(SheetCollection sheets)
The collection to observe; null is ignored.
Connects the navigation buttons and divider to their input handlers. Call the base implementation when overriding to retain the selector's built-in interactions.
protected virtual void AttachToSheetSelectorElementEvents()
Starts inline editing of the active sheet name when sheet changes are allowed. Does nothing if editing is already active or the workbook is protected.
public virtual void BeginEdit()
Ends inline sheet-name editing without applying the entered value.
public virtual void CancelEdit()
Creates the add-sheet tab appended when IsAddButtonVisible is enabled.
protected virtual AddNewSheetSelectorTabItem CreateAddNewSheetSelectorTabItem()
The tab item that initiates adding a worksheet.
Creates the navigation buttons, clipped sheet-tab container, draggable divider, and horizontal scrollbar.
protected override void CreateChildElements()
Overrides:
Creates the built-in sheet-tab menu with insert, delete, rename, tab-color, hide, and unhide actions. Hiding or deleting the last visible sheet is prevented.
public virtual RadContextMenu CreateDefaultSheetSelectorContextMenu()
The default context menu used when no custom sheet-selector menu is assigned.
Creates the navigation button that scrolls the tab strip to its first sheet.
Creates the navigation button that brings the last sheet tab into view.
Creates the navigation button that scrolls the tab strip toward later sheets.
Creates the navigation button that scrolls the tab strip toward earlier sheets.
Creates the tab item representing a workbook sheet.
protected virtual SheetSelectorTabItem CreateNewSheetSelectorTabItem(Sheet sheet)
The sheet represented by the new tab.
Returns:The tab item added to the selector for sheet.
Creates the container that clips the sheet tabs to their available width and supports horizontal scrolling.
protected virtual SheetTabItemsContainerElement CreateSheetTabItemsContainer()
Removes the selector's selection-changing handler from the active worksheet editor.
protected virtual void DetachFromActiveWorksheetEditorEventsEvents()
Removes the selector's change handlers from the specified sheet collection.
protected virtual void DetachFromSheetsCollectionEvents(SheetCollection sheets)
The collection to detach from; null is ignored.
Removes the input handlers installed by AttachToSheetSelectorElementEvents().
protected virtual void DetachFromSheetSelectorElementEvents()
Detaches workbook, worksheet-editor, and selector event handlers and releases the associated command descriptors.
protected override void DisposeManagedResources()
Overrides:
Ends inline sheet-name editing and applies a non-empty entered value through RenameSheetCommand.
public virtual void EndEdit()
Creates the built-in sheet-selector context menu if it has not already been created.
protected virtual void EnsureDefaultContextMenu()
Creates the input editor used to rename the active sheet. Override this method to provide a custom sheet-name editor.
protected virtual BaseInputEditor GetEditor()
The editor attached to the active sheet tab.
Sets the selector's initial state, including the visible add-sheet tab and the default tab-scroll animation.
protected override void InitializeFields()
Overrides:
Measures the navigation controls and divider, then allocates the remaining width to the sheet tabs. When either dimension is infinite, measurement is delegated to the base implementation.
Detaches sheet-tab event handlers and clears the tab container before disposal continues.
protected override void OnBeginDispose()
Overrides:
Commits an active sheet-name edit after the selector receives mouse input.
protected override void OnMouseDown(MouseEventArgs e)
The mouse event received by the selector.
Overrides:
Propagates changes to the selector's scroll-offset property to the sheet-tab container.
protected override void OnPropertyChanged(RadPropertyChangedEventArgs e)
The property-change event data.
Overrides:
Stops pending tab scrolling and clears the deferred tab-to-show when the selector leaves its element tree.
protected override void OnUnloaded(ComponentThemableElementTree oldTree)
The element tree the selector is leaving.
Overrides:
Validates and applies a proposed name to the sheet represented by the specified tab. Invalid or duplicate names display an alert and return false.
protected virtual bool RenameSheet(SheetSelectorTabItem tabItem, string name)
The tab whose sheet is being renamed.
namestringThe proposed sheet name.
Returns:true if the name is unchanged or was applied; otherwise, false.
Applies the dark-theme icon assets to the built-in sheet-selector context menu when theme icon changes are enabled.
protected virtual void SetDarkIcons()
Applies the standard icon assets to the built-in sheet-selector context menu when theme icon changes are enabled.
protected virtual void SetStandardIcons()
Raises the spreadsheet's context-menu event so handlers can replace or suppress the menu, then displays it at the pointer location. A custom menu from SheetSelectorContextMenu takes precedence over the default.
protected virtual void ShowSheetSelectorContextMenu(SheetSelectorTabItem currentItem, MouseEventArgs e)
The sheet tab that was clicked.
eMouseEventArgsThe mouse event that provides the menu location.
Selects the built-in sheet-selector context-menu icon assets for the control's current theme.
public virtual void UpdateIconSet()