Files

37 lines
1.6 KiB
Markdown
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common/RibbonControl/ViewModel/RibbonViewModel.cs
generated_at: "2026-04-17T16:43:10.907162+00:00"
model: "zai-org/GLM-5-FP8"
schema_version: 1
sha256: "8dad9abf58642b0f"
---
# Documentation: RibbonViewModel.cs
## 1. Purpose
`RibbonViewModel<TModel>` is a generic base class for ribbon control view models in a WPF/Prism application. It provides common infrastructure for ribbon-based UI components including command management, lifecycle methods (initialization, activation, cleanup), status publishing via event aggregation, and property change notification. This class serves as a foundation for specific ribbon view model implementations that manage a model of type `TModel`.
---
## 2. Public Interface
### Class Declaration
```csharp
public class RibbonViewModel<TModel> : BasePropertyChanged, IRibbonViewModel
where TModel : class
```
### Constructor
- **`RibbonViewModel(IRibbonView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)`** (protected)
- Initializes the view model with required dependencies. Assigns `View`, `Aggregator`, `Container`, and `RegionManager` properties, then calls `CreateCommands()`.
### Properties
| Property | Type | Access | Description |
|----------|------|--------|-------------|
| `Aggregator` | `IEventAggregator` | protected get | Prism event aggregator for pub/sub messaging. |
| `Container` | `IUnityContainer` | protected get | Unity IoC container. |
| `RegionManager` | `IRegionManager` | protected get | Prism region manager for view composition. |
| `Model` | `TModel` | public get/set |