--- source_files: - Common/DTS.CommonCore/Interface/DTS.Viewer/Legend/ILegendView.cs - Common/DTS.CommonCore/Interface/DTS.Viewer/Legend/ILegendViewModel.cs generated_at: "2026-04-16T12:22:08.946405+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "fa541836d2cec79b" --- # Documentation: ILegendView / ILegendViewModel ## 1. Purpose This module defines the core interfaces for a Legend component within a Viewer system, following the MVVM (Model-View-ViewModel) architectural pattern. `ILegendView` represents the view abstraction for legend visualization, while `ILegendViewModel` defines the contract for its corresponding ViewModel, establishing the relationship between the two layers. These interfaces enable decoupled communication between the legend's presentation logic and its UI rendering. --- ## 2. Public Interface ### `ILegendView` **Namespace:** `DTS.Common.Interface` **Inherits:** `IBaseView` A marker interface representing a legend view component. No members are defined beyond those inherited from `IBaseView`. ```csharp public interface ILegendView : IBaseView { } ``` --- ### `ILegendViewModel` **Namespace:** `DTS.Common.Interface` **Inherits:** `IBaseViewModel` Defines the contract for a legend ViewModel with access to its associated view. | Member | Type | Access | Description | |--------|------|--------|-------------| | `View` | `ILegendView` | `get` | Returns the associated `ILegendView` instance for this ViewModel. | ```csharp public interface ILegendViewModel : IBaseViewModel { ILegendView View { get; } } ``` --- ## 3. Invariants - `ILegendViewModel.View` must return a non-null `ILegendView` instance when accessed (implied by the contract, though nullability annotations are not present in the source). - Both interfaces must maintain their inheritance from `IBaseView` and `IBaseViewModel` respectively, ensuring consistency with the broader view/viewmodel hierarchy. - The `View` property on `ILegendViewModel` is read-only (getter only), suggesting the view association is established at construction or through internal mechanisms, not via public setters. --- ## 4. Dependencies ### This module depends on: - `DTS.Common.Base` — Provides `IBaseView` and `IBaseViewModel` base interfaces from which these interfaces inherit. ### What depends on this module: - **Cannot be determined from source alone.** Consumers would include concrete implementations of `ILegendView` and `ILegendViewModel`, as well as any components that render or interact with legend functionality. --- ## 5. Gotchas - **Marker Interface:** `ILegendView` defines no members of its own. All functionality comes from `IBaseView`. Developers should consult `IBaseView` to understand available members. - **Tight Coupling via Property:** The `ILegendViewModel.View` property creates a direct reference from the ViewModel to the View, which is a deviation from pure MVVM where ViewModels are typically view-agnostic. The rationale for this design choice is not documented in the source. - **Missing Nullability Annotations:** The source lacks C# 8.0+ nullable reference type annotations, making it unclear whether `View` is guaranteed to be non-null.