init
This commit is contained in:
58
docs/ai/DataPRO/Modules/ISO/ExtraProperties/View.md
Normal file
58
docs/ai/DataPRO/Modules/ISO/ExtraProperties/View.md
Normal file
@@ -0,0 +1,58 @@
|
||||
---
|
||||
source_files:
|
||||
- DataPRO/Modules/ISO/ExtraProperties/View/ExtraPropertiesListView.xaml.cs
|
||||
generated_at: "2026-04-17T16:14:53.590489+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "bd27f211c49da9eb"
|
||||
---
|
||||
|
||||
# View
|
||||
|
||||
### Purpose
|
||||
This module provides a WPF view component (`ExtraPropertiesListView`) for displaying, editing, sorting, and filtering a list of "extra properties" (key-value pairs) in an ISO-related context. It serves as the code-behind for an XAML user control, mediating user interactions (clicks, text changes, selection) to a view model and handling visual tree hit-testing for column header interactions.
|
||||
|
||||
### Public Interface
|
||||
|
||||
- **`ExtraPropertiesListView()`** (Constructor)
|
||||
- Initializes the component by calling `InitializeComponent()`.
|
||||
|
||||
- **`GridViewColumnHeaderSearchable_OnSearch(object sender, RoutedEventArgs e)`** (private event handler)
|
||||
- Extracts a search term from `e.OriginalSource` (as string) and a column tag from the sender. Calls `viewModel.Filter(columnTag, searchTerm)` on the `IExtraPropertiesListViewModel` DataContext.
|
||||
|
||||
- **`GridViewColumnHeader_OnClick(object sender, RoutedEventArgs e)`** (private event handler)
|
||||
- Extracts the column tag from the sender or via `Utils.FindChild<GridViewColumnHeaderSearchable>`. Calls `vm?.Sort(columnTag, true)` on the view model.
|
||||
|
||||
- **`ExtraPropertyKeyTextBox_KeyDown(object sender, KeyEventArgs e)`** / **`ExtraPropertyValueTextBox_KeyDown(...)`** (private event handlers)
|
||||
- Casts `DataContext` to `ExtraPropertiesListViewModel` and `e.Source`'s DataContext to `IExtraProperty`. Calls `vm.MarkModified(iep)`.
|
||||
|
||||
- **`ExtraPropertyKeyTextBox_TextChanged(object sender, TextChangedEventArgs e)`** / **`ExtraPropertyValueTextBox_TextChanged(...)`** (private event handlers)
|
||||
- Calls `vm.MarkModified(iep)` and then `vm.Validate(ref notUsed1, ref notUsed2)` with two empty `List<string>` instances.
|
||||
|
||||
- **`ExtraProperties_SelectionChanged(object sender, SelectionChangedEventArgs e)`** (private event handler)
|
||||
- Collects all `IExtraProperty` items from `lv.SelectedItems` into a list and calls `vm.SetSelection(list.ToArray())`.
|
||||
|
||||
- **`ExtraPropertiesListView_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)`** (private event handler)
|
||||
- Performs multiple hit-tests using `VisualTreeHelper.HitTest` and `InputHitTest`. Handles sorting when clicking on `KeyColumnHeader` or `ValueColumnHeader` (or their descendant TextBlocks). Ignores clicks on `ScrollViewer`.
|
||||
|
||||
### Invariants
|
||||
- The `DataContext` must be castable to `IExtraPropertiesListViewModel` for most operations; handlers early-return if not.
|
||||
- Items in the `ListView` must implement `IExtraProperty` for selection handling.
|
||||
- The view expects `GridViewColumnHeaderSearchable` controls with `Tag` properties for column identification.
|
||||
- `KeyColumnHeader` and `ValueColumnHeader` are named XAML elements that must exist.
|
||||
|
||||
### Dependencies
|
||||
- **Depends on:**
|
||||
- `DTS.Common.Controls` (for `GridViewColumnHeaderSearchable`)
|
||||
- `DTS.Common.Interface.ISO.ExtraProperties` (`IExtraPropertiesListView`, `IExtraPropertiesListViewModel`, `IExtraProperty`)
|
||||
- `DTS.Common.Utils` (for `Utils.FindChild<T>`)
|
||||
- `System.Windows.*` (WPF infrastructure)
|
||||
- `ExtraProperties.Resources.StringResources` (localized strings for "Key" and "Value")
|
||||
- **Depended on by:** Unclear from source alone; likely consumed by ISO module views.
|
||||
|
||||
### Gotchas
|
||||
- The `Validate` method is called with two throwaway `List<string>` instances (`notUsed1`, `notUsed2`) that are never examined. The validation results are discarded, which may indicate incomplete error handling or a side-effect-based validation pattern.
|
||||
- Multiple hit-tests are required in `ExtraPropertiesListView_PreviewMouseLeftButtonUp` due to visual tree complexity (borders, rectangles). This is fragile and may break with template changes.
|
||||
- The handler casts `DataContext` to the concrete `ExtraPropertiesListViewModel` in text/keydown handlers, but to the interface `IExtraPropertiesListViewModel` elsewhere—inconsistent pattern.
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user