14 KiB
14 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
2026-04-16T03:24:01.428865+00:00 | Qwen/Qwen3-Coder-Next-FP8 | 1 | 1a23dab67957c1ec |
RibbonControl Data Model Documentation
1. Purpose
This module defines the data model layer for a ribbon UI control framework. It provides a hierarchy of data classes that represent the structure and state of ribbon UI elements—including tabs, groups, controls, menus, galleries, and context-aware groupings—enabling data binding and declarative UI construction. The classes are designed to support MVVM patterns through INotifyPropertyChanged implementations and command binding, with static default data generation via ViewModelData for design-time and testing scenarios. The module serves as the backend data contract for a WPF-based ribbon control implementation.
2. Public Interface
Core Data Classes
ButtonData
- Inherits from:
ControlData - Description: Represents a standard button control in the ribbon. No additional properties beyond those inherited from
ControlData.
SeparatorData
- Inherits from:
ControlData - Description: Represents a visual separator between controls. No additional properties beyond
ControlData.
GalleryItemData
- Inherits from:
ControlData - Description: Represents an individual item within a gallery. No additional properties beyond
ControlData.
ComboBoxData
- Inherits from:
MenuButtonData - Description: Represents a combo box control. Inherits all properties and behavior from
MenuButtonData.
TextBoxData
- Inherits from:
ControlData - Properties:
string Text: Gets/sets the text content. RaisesPropertyChangedon change.
CheckBoxData
- Inherits from:
ControlData - Properties:
bool IsChecked: Gets/sets the checked state. RaisesPropertyChangedon change.
RadioButtonData
- Inherits from:
ControlData - Properties:
bool IsChecked: Gets/sets the checked state. RaisesPropertyChangedon change.
ToggleButtonData
- Inherits from:
ControlData - Properties:
bool IsChecked: Gets/sets the checked state. RaisesPropertyChangedon change.
SplitButtonData
- Inherits from:
MenuButtonData - Properties:
bool IsChecked: Gets/sets the checked state. RaisesPropertyChangedon change.bool IsCheckable: Gets/sets whether the button can be toggled. RaisesPropertyChangedon change.ButtonData DropDownButtonData: Returns a lazily-initializedButtonDatainstance representing the dropdown portion of the split button.
MenuItemData
- Inherits from:
SplitButtonData - Constructors:
MenuItemData(): Callsthis(false).MenuItemData(bool isApplicationMenu): Calls base constructor withisApplicationMenu.
- Description: Represents a menu item. Inherits all properties from
SplitButtonData.
SplitMenuItemData
- Inherits from:
MenuItemData - Constructors:
SplitMenuItemData(): Callsthis(false).SplitMenuItemData(bool isApplicationMenu): Calls base constructor withisApplicationMenu.
- Description: Represents a split menu item (menu item with dropdown). Inherits all properties from
MenuItemData.
ApplicationMenuItemData
- Inherits from:
MenuItemData - Constructors:
ApplicationMenuItemData(): Callsthis(false).ApplicationMenuItemData(bool isApplicationMenu): Calls base constructor withisApplicationMenu.
- Description: Represents a menu item specifically intended for use in the application menu. Inherits all properties from
MenuItemData.
ApplicationSplitMenuItemData
- Inherits from:
SplitMenuItemData - Constructors:
ApplicationSplitMenuItemData(): Callsthis(false).ApplicationSplitMenuItemData(bool isApplicationMenu): Calls base constructor withisApplicationMenu.
- Description: Represents a split menu item for the application menu. Inherits all properties from
SplitMenuItemData.
ControlData
- Base class for all ribbon control data classes.
- Properties:
string LabelUri LargeImageUri SmallImagestring ToolTipTitlestring ToolTipDescriptionUri ToolTipImagestring ToolTipFooterTitlestring ToolTipFooterDescriptionUri ToolTipFooterImageICommand Commandstring KeyTip
- All properties raise
PropertyChangedon change.
MenuButtonData
- Inherits from:
ControlData - Constructors:
MenuButtonData(): Callsthis(false).MenuButtonData(bool isApplicationMenu): Initializes withisApplicationMenuflag.
- Properties:
bool IsVerticallyResizablebool IsHorizontallyResizableObservableCollection<ControlData> ControlDataCollection: Lazily-initialized collection containing galleries, menu items, split menu items, and separators (see implementation for exact composition).
- Note: Uses internal
_nestingDepthfield to limit recursive menu nesting.
GalleryCategoryData
- Inherits from:
ControlData - Properties:
ObservableCollection<GalleryItemData> GalleryItemDataCollection: Lazily-initialized collection of 10GalleryItemDatainstances with default values (label, images, tooltips, command).
- Generic variant
GalleryCategoryData<T>also exists withObservableCollection<T> GalleryItemDataCollection.
GalleryData
- Inherits from:
ControlData - Properties:
ObservableCollection<GalleryCategoryData> CategoryDataCollection: Lazily-initialized collection of 3GalleryCategoryDatainstances with default values.GalleryItemData SelectedItem: Gets/sets the selected item. RaisesPropertyChangedon change.bool CanUserFilter: Gets/sets whether filtering is enabled. RaisesPropertyChangedon change.
- Generic variant
GalleryData<T>also exists withObservableCollection<GalleryCategoryData<T>> CategoryDataCollectionandT SelectedItem.
ContextualTabGroupData
- Implements:
INotifyPropertyChanged - Constructors:
ContextualTabGroupData(): Callsthis(null).ContextualTabGroupData(string header): Initializes with header.
- Properties:
string Headerbool IsVisibleObservableCollection<TabData> TabDataCollection: Lazily-initialized collection.
- Used to group tabs that appear together under a contextual header.
TabData
- Implements:
INotifyPropertyChanged - Constructors:
TabData(): Callsthis(null).TabData(string header): Initializes with header.
- Properties:
string Headerstring ContextualTabGroupHeader: Associates tab with aContextualTabGroupData.bool IsSelectedObservableCollection<GroupData> GroupDataCollection: Lazily-initialized collection of 3GroupDatainstances with default values.
GroupData
- Inherits from:
ControlData - Constructors:
GroupData(string header): SetsLabeltoheader.
- Properties:
ObservableCollection<ControlData> ControlDataCollection: Lazily-initialized collection containing 1 each ofButton,ToggleButton,RadioButton,CheckBox,TextBox,MenuButton,SplitButton, andComboBoxinstances with default values.
RibbonData
- Implements:
INotifyPropertyChanged - Properties:
ObservableCollection<TabData> TabDataCollection: Lazily-initialized collection of 4TabDatainstances. First two tabs are associated with contextual tab groups (Grp 0,Grp 1), remaining two are non-contextual.ObservableCollection<ContextualTabGroupData> ContextualTabGroupDataCollection: Lazily-initialized collection of 2ContextualTabGroupDatainstances (Grp 0,Grp 1), all visible.MenuButtonData ApplicationMenuData: Lazily-initialized application menu button with default values.
Static Data Provider
ViewModelData
- Namespace:
DTS.Common.RibbonControl - Static Properties:
RibbonData RibbonData: Returns a thread-static instance ofRibbonData.ICommand DefaultCommand: Returns aDelegateCommandthat always returnstrueforCanExecuteand does nothing onExecute.
- Internal Constants: Define default counts for UI elements (e.g.,
TabCount = 4,ControlCount = 5, etc.).
3. Invariants
- All data classes inherit from
ControlData(exceptContextualTabGroupDataandRibbonData), ensuring consistent property set (Label,Command,SmallImage, etc.) across all controls. ControlDataproperties follow a strict pattern: change detection via reference equality (==) before raisingPropertyChanged.ControlDataCollectionproperties inMenuButtonData,GroupData,GalleryCategoryData, andGalleryDataare lazily initialized and populated only once per instance (no re-initialization on subsequent access).RibbonData.TabDataCollectionandContextualTabGroupDataCollectionare lazily initialized and populated exactly once per instance.ViewModelData.RibbonDatauses[ThreadStatic], meaning each thread gets its own independentRibbonDatainstance.- Menu nesting depth is limited to
ViewModelData.MenuItemNestingCount(value2) inMenuButtonData.ControlDataCollectionvia internal_nestingDepthtracking. IsCheckableis explicitly set totrueonly forSplitButtonDataandSplitMenuItemDatainstances inGroupDataandMenuButtonDatarespectively.IsApplicationMenuflag is propagated through constructors toMenuButtonDataand its subclasses (MenuItemData,SplitMenuItemData, etc.) to influence initialization behavior.
4. Dependencies
Internal Dependencies (within module)
- All classes reside in
DTS.Common.RibbonControlnamespace. ControlDatais the base class for most data classes.MenuButtonDatais a base class forSplitButtonData,ComboBoxData, andMenuItemDatahierarchy.SplitButtonDatais a base class forSplitMenuItemDataandApplicationSplitMenuItemData.MenuItemDatais a base class forSplitMenuItemDataandApplicationMenuItemData.ApplicationMenuItemDataandApplicationSplitMenuItemDataextendMenuItemDataandSplitMenuItemDatarespectively with application-menu-specific semantics.
External Dependencies
System.ComponentModel(INotifyPropertyChanged,PropertyChangedEventArgs,DesignerSerializationVisibilityAttribute)System.Windows.Input(ICommand,DelegateCommand)System.Collections.ObjectModel(ObservableCollection<T>)Prism.Commands(DelegateCommand) — used inViewModelData.DefaultCommand- WPF-specific types:
Uri(for image paths),DesignerSerializationVisibility
What depends on this module
- UI rendering layer (not included in source) — consumes these data classes to bind to WPF controls.
- Test or design-time code — uses
ViewModelDatato generate sample data.
5. Gotchas
- Thread-Safe Data Isolation:
ViewModelData.RibbonDatauses[ThreadStatic], meaning each thread gets its ownRibbonDatainstance. This may cause unexpected behavior if data is expected to be shared across threads. - Hardcoded Default Values: Many collections (
GroupData.ControlDataCollection,GalleryCategoryData.GalleryItemDataCollection, etc.) are populated with hardcoded default values (e.g.,"Paste_16x16.png","ToolTip Title"). These are not configurable via public API. - One-Time Initialization: Collections like
TabData.GroupDataCollectionandGroupData.ControlDataCollectionare initialized only once. Modifying the collection after first access will not trigger re-initialization, but adding/removing items is allowed. - Nesting Depth Limitation:
MenuButtonData.ControlDataCollectionstops populating menu items after_nestingDepthreachesViewModelData.MenuItemNestingCount(2). This limit is internal and not exposed. IsCheckableNot Universal: OnlySplitButtonDataandSplitMenuItemDatainstances haveIsCheckable = trueset in their default initialization. RegularButtonData,ToggleButtonData, etc., do not have this property set (thoughToggleButtonData,CheckBoxData,RadioButtonDatahaveIsChecked).GalleryData.SelectedItemType Mismatch: The non-genericGalleryDatausesGalleryItemDataforSelectedItem, while the genericGalleryData<T>usesT. Ensure type consistency when using the generic variant.ContextualTabGroupHeaderNot Enforced:TabData.ContextualTabGroupHeaderis a string property; there is no validation ensuring it matches an actualContextualTabGroupData.Header.CommandNot Used in Default Logic: WhileCommandproperties are set toViewModelData.DefaultCommandin default data, there is no logic in these classes to invoke or validate the command.- No Public Constructors for Generic Types: Generic classes (
GalleryCategoryData<T>,GalleryData<T>) lack custom constructors, limiting initialization flexibility.
None identified from source alone.