Files
DP44/docs/ai/Common/DTS.Common/RibbonControl.md
2026-04-17 14:55:32 -04:00

2.2 KiB

source_files, generated_at, model, schema_version, sha256
source_files generated_at model schema_version sha256
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
2026-04-17T15:36:06.822929+00:00 zai-org/GLM-5-FP8 1 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