--- source_files: - Common/DTS.Common/obj/x86/Debug/Resources/MainTabControlResource.g.i.cs - Common/DTS.Common/obj/x86/Debug/Resources/MainTabControlResource.g.cs generated_at: "2026-04-16T02:57:06.316466+00:00" model: "Qwen/Qwen3-Coder-Next-FP8" schema_version: 1 sha256: "45fa1f39ee4a4148" --- # Resources ## Documentation: `MainTabControlResource` Class ### 1. Purpose `MainTabControlResource` is an auto-generated WPF `ResourceDictionary` subclass that loads and applies styling and behavior for a `TabControl` defined in the XAML file `MainTabControlResource.xaml`. Its role is to encapsulate resource definitions (e.g., styles, templates, event handlers) used to customize the appearance and interaction of a main tab control throughout the application—specifically, by attaching a `ToolTipOpening` event handler to elements using the associated style. This class is not intended for direct instantiation or manual modification; it is generated at build time by the WPF build tasks and should be treated as part of the compiled resource infrastructure. ### 2. Public Interface The class exposes only one *public* method: - **`void InitializeComponent()`** - **Signature**: `public void InitializeComponent()` - **Behavior**: Loads the XAML resource dictionary from the embedded URI `/DTS.Common;component/resources/maintabcontrolresource.xaml` using `Application.LoadComponent`. It ensures initialization occurs only once via the `_contentLoaded` flag. This method is automatically invoked by the WPF framework when the resource dictionary is instantiated (e.g., when merged into an `Application.Resources` or `UserControl.Resources`). The class also implements two *explicit interface implementations* (not public in the traditional sense, but required for XAML infrastructure): - **`void IComponentConnector.Connect(int connectionId, object target)`** - Marks the object as initialized (`_contentLoaded = true`). No further logic is present. - **`void IStyleConnector.Connect(int connectionId, object target)`** - For `connectionId == 1`, creates an `EventSetter` for `FrameworkElement.ToolTipOpeningEvent`, assigns `this.ToolTipEventHandler` as the handler, and adds it to the style’s setters. - **Note**: The method `ToolTipEventHandler` is referenced but *not defined* in the generated code. Its implementation must reside in the corresponding `.xaml.cs` file (not provided here), or the build would fail. ### 3. Invariants - `_contentLoaded` is `false` initially and set to `true` on first call to `InitializeComponent()` or `IComponentConnector.Connect()`. Subsequent calls to `InitializeComponent()` are no-ops. - The `ToolTipEventHandler` method *must* exist (as a private/protected instance method) in the partial class (e.g., in `MainTabControlResource.xaml.cs`) for the `IStyleConnector.Connect` logic to compile and execute correctly. - The XAML file `MainTabControlResource.xaml` must exist at the specified relative path (`..\..\..\..\Resources\MainTabControlResource.xaml`) and contain a style (with `x:Key` or implicit) that uses `connectionId=1` for its `IStyleConnector` mapping. - The resource dictionary is loaded as a **component** (via `Application.LoadComponent`), meaning its resources are merged into the application’s resource scope at runtime. ### 4. Dependencies - **Build-time**: Requires `PresentationBuildTasks` (WPF build tools) to generate this file from `MainTabControlResource.xaml`. - **Runtime**: - `System.Windows.Application.LoadComponent` (WPF core) - `System.Windows.ResourceDictionary` (base class) - `Microsoft.Windows.Controls` (likely referencing an external control library, e.g., Microsoft Toolkit or similar—used for `using Microsoft.Windows.Controls;`) - `System.Windows.Controls.ToolTipEventHandler` delegate - `System.Windows.FrameworkElement.ToolTipOpeningEvent` routed event - **Source file dependency**: `Resources/MainTabControlResource.xaml` (not included, but its existence and structure are required). - **Consumers**: Implicitly used when `MainTabControlResource.xaml` is referenced in XAML (e.g., via `` or `MergedDictionaries`). No direct consumers are evident from this file alone. ### 5. Gotchas - **Partial class requirement**: The class is `partial`, but the `ToolTipEventHandler` method is *not defined* in the generated code. Its absence in the `.xaml.cs` file will cause a compilation error. - **Auto-generated warning**: Both files explicitly warn that manual changes will be lost on regeneration. This is standard for WPF build outputs. - **No public API surface**: This class is not meant to be extended or used directly beyond its role as a resource dictionary loader. Attempting to subclass it without care may break XAML connectivity. - **`connectionId=1` is hardcoded**: The `IStyleConnector.Connect` logic assumes exactly one style in the XAML uses `connectionId=1`. If the XAML changes (e.g., multiple styles with event setters), the mapping may break or require re-synchronization. - **No validation of XAML content**: The class does not validate the XAML structure—malformed XAML in `MainTabControlResource.xaml` will cause runtime exceptions during `LoadComponent`. - **No documentation of `ToolTipEventHandler` behavior**: Since the handler’s implementation is external, its side effects (e.g., tooltip content logic, performance implications) are unknown from this source. None identified beyond the above.