80 lines
7.2 KiB
Markdown
80 lines
7.2 KiB
Markdown
---
|
||
source_files:
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/RoundedBox.g.i.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/RoundedBox.g.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/TestIDView.g.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/TestIDView.g.i.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/TestIDControl.g.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/TestIDControl.g.i.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/CommonStatusRibbon.g.i.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/CommonStatusRibbon.g.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/TestIDTestBox.g.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/TestIDTestBox.g.i.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/LookupPopup.g.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/LookupPopup.g.i.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/checkbox.g.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/checkbox.g.i.cs
|
||
- Common/DTS.Common/obj/x86/Debug/Controls/GridViewColumnHeaderSearchable.g.cs
|
||
generated_at: "2026-04-16T02:57:21.705051+00:00"
|
||
model: "Qwen/Qwen3-Coder-Next-FP8"
|
||
schema_version: 1
|
||
sha256: "b0a99f13377fec7b"
|
||
---
|
||
|
||
# Documentation: `DTS.Common.Controls` Auto-Generated WPF Control Files
|
||
|
||
## 1. Purpose
|
||
|
||
This directory contains auto-generated C# source files produced by the WPF build toolchain (`PresentationBuildTasks`) for several custom user controls and resources in the `DTS.Common` assembly. These files are not hand-written code but are generated at build time from corresponding `.xaml` files to implement the WPF `IComponentConnector` and `IStyleConnector` interfaces required for runtime XAML loading, event wiring, and field initialization. Their purpose is to enable the WPF runtime to correctly instantiate and connect UI elements defined in XAML to their code-behind classes (e.g., assigning `x:Name`-declared fields, attaching event handlers, and loading component resources). They do not contain business logic themselves but are essential infrastructure for the controls to function.
|
||
|
||
## 2. Public Interface
|
||
|
||
All classes are `public partial` and reside in the `DTS.Common.Controls` namespace. They implement `System.Windows.Markup.IComponentConnector`. None expose custom public methods or properties beyond standard WPF `UserControl`/`Popup`/`ResourceDictionary` behavior.
|
||
|
||
| Class | Base Type | Key Public Members |
|
||
|-------|-----------|--------------------|
|
||
| `RoundedBox` | `System.Windows.Controls.UserControl` | `void InitializeComponent()` |
|
||
| `TestIDView` | `System.Windows.Controls.UserControl` | `void InitializeComponent()` |
|
||
| `TestIdControl` | `System.Windows.Controls.UserControl` | `void InitializeComponent()` |
|
||
| `CommonStatusRibbon` | `System.Windows.Controls.UserControl` | `void InitializeComponent()`, internal fields: `commonStatusRibbon`, `lblAggregateStatusText` |
|
||
| `TestIDTextBox` | `System.Windows.Controls.UserControl` | `void InitializeComponent()`, internal fields: `TestIdTextBoxControl`, `tbTestId` |
|
||
| `LookupPopup` | `System.Windows.Controls.Primitives.Popup` | `void InitializeComponent()`, internal fields: `lookupPopup`, `possibleChannels` |
|
||
| `checkbox` | `System.Windows.ResourceDictionary` | `void InitializeComponent()`, implements `IStyleConnector` |
|
||
| `GridViewColumnHeaderSearchable` | `System.Windows.Controls.UserControl` | `void InitializeComponent()`, internal fields: `dtsGridViewColumnHeader`, `mainGrid`, `TogglePopupButton`, `BtnArrow`, `ToggledPopup` |
|
||
|
||
**Note on `IComponentConnector.Connect`**: This interface method is implemented explicitly and is not intended for direct use. It is called by the WPF runtime during component initialization to wire up named elements and event handlers. Its behavior is fully determined by the corresponding `.xaml` file.
|
||
|
||
## 3. Invariants
|
||
|
||
- **`_contentLoaded` flag**: Each class maintains a private `bool _contentLoaded` field. `InitializeComponent()` is idempotent: it returns immediately if `_contentLoaded` is already `true`.
|
||
- **XAML resource URIs**: All calls to `Application.LoadComponent` use relative URIs of the form `/DTS.Common;component/controls/{filename}.xaml`, where `{filename}` matches the control’s XAML file (case-insensitive, e.g., `roundedbox.xaml`, `testidview.xaml`).
|
||
- **Connection ID mapping**: The `Connect(int connectionId, object target)` method uses `connectionId` values to identify which XAML-declared element or style setter is being wired. These IDs are stable per XAML file and generated by the build tool.
|
||
- **No side effects in `Connect`**: The `Connect` method only assigns fields and adds event handlers; it does not mutate external state or perform validation beyond casting.
|
||
|
||
## 4. Dependencies
|
||
|
||
### Internal Dependencies (from imports)
|
||
- `System.Windows.*` (WPF core namespaces)
|
||
- `Microsoft.Windows.Controls` (likely from an external control library, e.g., Microsoft Toolkit or similar)
|
||
- `DTS.Common.Strings` (used only in `LookupPopup.g.cs` and `LookupPopup.g.i.cs`)
|
||
- `DTS.Common.Controls` (self-referential for internal field assignments)
|
||
|
||
### External Dependencies
|
||
- `System.dll`, `PresentationFramework.dll`, `WindowsBase.dll`, `PresentationCore.dll` (standard WPF assemblies)
|
||
- `Microsoft.Windows.Controls` (external assembly referenced at build time)
|
||
- XAML source files in `Controls/` directory (e.g., `RoundedBox.xaml`, `LookupPopup.xaml`)
|
||
|
||
### What Depends on This Module?
|
||
- The corresponding partial classes in the codebase (e.g., `RoundedBox.xaml.cs`, `LookupPopup.xaml.cs`) depend on these generated files to initialize their UI and event handlers.
|
||
- Any code that instantiates these controls (e.g., `new RoundedBox()`) implicitly relies on `InitializeComponent()` being called (typically via the constructor in the partial class).
|
||
|
||
## 5. Gotchas
|
||
|
||
- **Auto-generated only**: These files are *not* meant to be edited. Changes will be overwritten on rebuild. Custom logic must reside in the corresponding `.xaml.cs` files.
|
||
- **Case sensitivity**: XAML filenames (e.g., `roundedbox.xaml`, `testidview.xaml`) are referenced in URIs with lowercase names, but class names (e.g., `RoundedBox`, `TestIDView`) use PascalCase. Ensure XAML file names match exactly (case-sensitive on case-sensitive file systems).
|
||
- **Event handler naming**: Event handlers (e.g., `tbTestId_PreviewTextInput`, `LookupPopup_OnOpenedClosed`) are referenced in generated code but are *not defined in these files*. They must be implemented in the corresponding `.xaml.cs` files.
|
||
- **Field naming inconsistencies**: Some controls use camelCase for internal fields (`commonStatusRibbon`, `lookupPopup`, `dtsGridViewColumnHeader`), while others use PascalCase (`TestIdInfo`, `TestIdTextBoxControl`). This reflects naming conventions in the source XAML (`x:Name` attributes).
|
||
- **`IStyleConnector` usage**: The `checkbox` control implements `IStyleConnector`, meaning it wires event setters in styles (e.g., `ToolTipOpening` handlers). This implies the XAML defines styles with `x:Key` or implicit targeting, and handlers like `ToolTipEventHandler` must exist in the code-behind.
|
||
- **Missing source files**: The documentation cannot verify the actual behavior of controls (e.g., `LookupPopup`’s `PossibleChannels_OnMouseDoubleClick` handler) because the corresponding `.xaml` and `.xaml.cs` files are not provided. Behavior is inferred only from event subscription in generated code.
|
||
|
||
None identified beyond the above. |