--- source_files: - Common/DTS.Common/RibbonControl/RibbonControlSelectionChanged.cs - Common/DTS.Common/RibbonControl/RibbonControlOperation.cs - Common/DTS.Common/RibbonControl/RibbonControlSelectionEventArgs.cs - Common/DTS.Common/RibbonControl/RibbonControlSelectionChangeBehavior.cs - Common/DTS.Common/RibbonControl/RibbonRegionAdapter.cs generated_at: "2026-04-17T15:36:06.822929+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "12c8c7227de24833" --- # Documentation: DTS.Common.RibbonControl ## 1. Purpose This module provides Prism region adapter support and event infrastructure for integrating WPF `Ribbon` controls into a Prism-based application. It enables dynamic addition and removal of `RibbonTab` and `RibbonApplicationMenu` items through Prism's region management system, synchronizes tab selection between document/workspace views and ribbon tabs via event aggregation, and exposes selection change notifications for consumers to react to ribbon tab changes. --- ## 2. Public Interface ### Classes #### `RibbonRegionAdapter` **Signature:** `public class RibbonRegionAdapter : RegionAdapterBase, IDisposable` A Prism region adapter that adapts `Microsoft.Windows.Controls.Ribbon.Ribbon` for use with `RegionNames.RibbonRegion`. Handles synchronization between active views and ribbon tab selection. | Member | Signature | Description | |--------|-----------|-------------| | Constructor | `RibbonRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory, IRegionManager regionManager, IEventAggregator eventAggregator)` | Creates a new instance with injected dependencies. Subscribes to `TabControlSelectionChanged` event. | | `Dispose()` | `public void Dispose()` | Unsubscribes from `TabControlSelectionChanged` event and releases resources. | **Protected Members:** - `Adapt(IRegion region, Ribbon regionTarget)` - Handles `ActiveViews.CollectionChanged` to add/remove `RibbonTab` and `RibbonApplicationMenu` items. - `CreateRegion()` - Returns a new `AllActiveRegion`. --- #### `RibbonControlSelectionChangeBehavior` **Signature:** `public class RibbonControlSelectionChangeBehavior : Behavior` A WPF behavior that attaches to a `Ribbon` and publishes `RibbonControlSelectionChanged` events when the ribbon's selection