117 lines
6.1 KiB
Markdown
117 lines
6.1 KiB
Markdown
|
|
---
|
||
|
|
source_files:
|
||
|
|
- DTS Viewer/DTS.Viewer/Classes/MenuItem.cs
|
||
|
|
- DTS Viewer/DTS.Viewer/Classes/TabItem.cs
|
||
|
|
- DTS Viewer/DTS.Viewer/Classes/NavigationItem.cs
|
||
|
|
- DTS Viewer/DTS.Viewer/Classes/BindingProxy.cs
|
||
|
|
- DTS Viewer/DTS.Viewer/Classes/ComplonentsGroupControl.cs
|
||
|
|
generated_at: "2026-04-16T11:22:34.808193+00:00"
|
||
|
|
model: "zai-org/GLM-5-FP8"
|
||
|
|
schema_version: 1
|
||
|
|
sha256: "e704fa30e232a4ba"
|
||
|
|
---
|
||
|
|
|
||
|
|
# Documentation: DTS.Viewer Classes
|
||
|
|
|
||
|
|
## 1. Purpose
|
||
|
|
|
||
|
|
This module provides a collection of UI support classes for the DTS Viewer WPF application. It includes data binding helpers (`BindingProxy`), custom controls (`ComponentsGroupControl`), and placeholder model classes (`MenuItem`, `TabItem`, `NavigationItem`) that appear to support the application's navigation and presentation layer. The module exists to enable XAML-specific features like data binding in non-visual contexts and to provide reusable UI components.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 2. Public Interface
|
||
|
|
|
||
|
|
### `DTS.Viewer.BindingProxy`
|
||
|
|
|
||
|
|
A `Freezable`-derived class that enables data binding in contexts where the DataContext is not naturally inherited (e.g., from within a Style or DataTrigger).
|
||
|
|
|
||
|
|
| Member | Signature | Description |
|
||
|
|
|--------|-----------|-------------|
|
||
|
|
| `DataProperty` | `public static readonly DependencyProperty` | Dependency property backing store for `Data`. Registered with name `"Data"`, type `object`, owner type `BindingProxy`. |
|
||
|
|
| `Data` | `public object Data { get; set; }` | Gets or sets an arbitrary data object for binding purposes. Uses `GetValue`/`SetValue` on `DataProperty`. |
|
||
|
|
| `CreateInstanceCore` | `protected override Freezable CreateInstanceCore()` | Required override for `Freezable`. Returns a new instance of `BindingProxy`. |
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### `DTS.Viewer.ComponentsGroupControl`
|
||
|
|
|
||
|
|
A custom `Control` for displaying a grouped component with an image and title.
|
||
|
|
|
||
|
|
| Member | Signature | Description |
|
||
|
|
|--------|-----------|-------------|
|
||
|
|
| `ClickEventArgs` | `public class ClickEventArgs : EventArgs` | Nested class for click event arguments. Contains only a default constructor. |
|
||
|
|
| `ClickCommand` | `public static RoutedCommand ClickCommand { get; }` | Static routed command named `"ClickCommand"`. Returns the private `_click` field. |
|
||
|
|
| `ImageProperty` | `public static readonly DependencyProperty ImageProperty` | Dependency property for the `Image` property. Type `ImageSource`, default value `null`. |
|
||
|
|
| `Image` | `public ImageSource Image { get; set; }` | Gets or sets the image source displayed by the control. |
|
||
|
|
| `TitleProperty` | `public static readonly DependencyProperty TitleProperty` | Dependency property for the `Title` property. Type `string`, default value `"Title"`. |
|
||
|
|
| `Title` | `public string Title { get; set; }` | Gets or sets the title text displayed by the control. |
|
||
|
|
|
||
|
|
**Private/Static Members:**
|
||
|
|
- `private static RoutedCommand _click` — Backing field for `ClickCommand`.
|
||
|
|
- `private static void OnCommandExecute(object sender, ExecutedRoutedEventArgs e)` — Command handler; casts sender to `ComponentsGroupControl` but performs no further action.
|
||
|
|
- `private static void InitializeCommands()` — Registers the `ClickCommand` with `CommandManager`.
|
||
|
|
- `static ComponentsGroupControl()` — Static constructor that overrides `DefaultStyleKeyProperty` metadata and initializes commands.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### `DTS.Viewer.MenuItem`
|
||
|
|
|
||
|
|
An empty internal class with no members. Purpose unclear from source alone.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### `DTS.Viewer.Classes.TabItem`
|
||
|
|
|
||
|
|
An empty internal class with no members. Purpose unclear from source alone.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
### `DTS.Viewer.Classes.NavigationItem`
|
||
|
|
|
||
|
|
An empty public class with no members. Purpose unclear from source alone.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 3. Invariants
|
||
|
|
|
||
|
|
- **BindingProxy**: As a `Freezable` subclass, `CreateInstanceCore()` must always return a new instance of `BindingProxy` (currently satisfied).
|
||
|
|
- **ComponentsGroupControl**:
|
||
|
|
- The static constructor always runs before any instance is created, ensuring `DefaultStyleKeyProperty` metadata is overridden and commands are registered.
|
||
|
|
- `Title` property defaults to the string `"Title"` (via `UIPropertyMetadata`).
|
||
|
|
- `Image` property defaults to `null`.
|
||
|
|
- **Dependency Properties**: All dependency properties follow WPF conventions—registered with correct owner types and accessed via `GetValue`/`SetValue`.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 4. Dependencies
|
||
|
|
|
||
|
|
### Imports (What this module depends on):
|
||
|
|
|
||
|
|
| Class | Dependencies |
|
||
|
|
|-------|--------------|
|
||
|
|
| `BindingProxy` | `System.Windows` (Freezable, DependencyProperty) |
|
||
|
|
| `ComponentsGroupControl` | `System`, `System.Windows`, `System.Windows.Controls`, `System.Windows.Input`, `System.Windows.Media` |
|
||
|
|
| `MenuItem`, `TabItem`, `NavigationItem` | None (no imports) |
|
||
|
|
|
||
|
|
### Dependents (What depends on this module):
|
||
|
|
|
||
|
|
**Cannot be determined from source alone.** These classes are likely referenced by XAML files, view models, or other code files not provided in this source set.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
## 5. Gotchas
|
||
|
|
|
||
|
|
1. **`ComponentsGroupControl.OnCommandExecute` does nothing useful**: The method casts the sender to `ComponentsGroupControl` but performs no action afterward. The actual click handling logic is either missing or expected to be implemented elsewhere (possibly in XAML or a code-behind not shown).
|
||
|
|
|
||
|
|
2. **Commented-out code in `ComponentsGroupControl`**: Several members are commented out:
|
||
|
|
- `SubtitleProperty` and `Subtitle` property
|
||
|
|
- `TabItemProperty` and `TabItem` property (referencing a type `DataModel.TabPageItem`)
|
||
|
|
- `ClickEventHandler` delegate and `OnClicked` event
|
||
|
|
|
||
|
|
This suggests incomplete refactoring or features that were started but not finished.
|
||
|
|
|
||
|
|
3. **Empty placeholder classes**: `MenuItem`, `TabItem`, and `NavigationItem` have no members whatsoever. They may be stubs awaiting implementation, used only as markers in XAML, or remnants of abandoned development.
|
||
|
|
|
||
|
|
4. **Namespace inconsistency**: `MenuItem` is in `DTS.Viewer` namespace, while `TabItem` and `NavigationItem` are in `DTS.Viewer.Classes`. This inconsistency may cause confusion when locating classes.
|
||
|
|
|
||
|
|
5. **`ClickEventArgs` is defined but never used**: The nested `ClickEventArgs` class exists in `ComponentsGroupControl`, but the associated event (`OnClicked`) is commented out, making this class currently unused.
|