This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
---
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<Ribbon>, 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<Ribbon>`
A WPF behavior that attaches to a `Ribbon` and publishes `RibbonControlSelectionChanged` events when the ribbon's selection