2.7 KiB
2.7 KiB
source_files, generated_at, model, schema_version, sha256
| source_files | generated_at | model | schema_version | sha256 | ||
|---|---|---|---|---|---|---|
|
2026-04-17T16:24:44.545909+00:00 | zai-org/GLM-5-FP8 | 1 | bc7a539f71ee8ad5 |
RegionAdapters
Purpose
This module provides Prism region adapters for StackPanel controls, enabling WPF StackPanel elements to participate in Prism's region navigation and view composition system. It contains two adapters—StackPanelRegionAdapter and ViewerStackPanelRegionAdapter—that synchronize region views with the panel's Children collection, allowing dynamic addition and removal of UI elements through region management.
Public Interface
StackPanelRegionAdapter
- Constructor:
StackPanelRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)— Initializes the adapter with the specified behavior factory. - Inherits from
RegionAdapterBase<StackPanel>
ViewerStackPanelRegionAdapter
- Constructor:
ViewerStackPanelRegionAdapter(IRegionBehaviorFactory regionBehaviorFactory)— Initializes the adapter with the specified behavior factory. - Inherits from
RegionAdapterBase<StackPanel>
Invariants
- Both adapters create an
AllActiveRegionviaCreateRegion(), meaning all views in the region are considered active at all times. - The
Adaptmethod returns immediately ifregionis null; no exception is thrown. - Only
AddandRemovecollection change actions are handled;Replace,Move, andResetactions are ignored.
Dependencies
- Depends on:
System.Windows(forUIElement),System.Windows.Controls(forStackPanel),System.Collections.Specialized(forNotifyCollectionChangedAction),Microsoft.Practices.Prism.Regions(forRegionAdapterBase<T>,IRegion,IRegionBehaviorFactory,AllActiveRegion) - Dependents: Unknown from source alone; likely registered during application bootstrapping or module initialization.
Gotchas
- Code duplication:
StackPanelRegionAdapterandViewerStackPanelRegionAdapterhave identical implementations. The reason for two separate classes is unclear from source alone—possibly for different registration scopes or naming conventions in different modules. - Memory leak potential: The
CollectionChangedevent handler is attached but never detached. If the region or adapter lifetime exceeds theStackPanellifetime, this could prevent garbage collection. - Unhandled collection actions:
NotifyCollectionChangedAction.Replace,Move, andResetare not handled in the switch statement. AResetaction (e.g., fromClear()) would not clear theStackPanel.Children.