📜 Codex: Documentation Synchronization and Architectural Articulation#295
📜 Codex: Documentation Synchronization and Architectural Articulation#295tedd wants to merge 1 commit into
Conversation
- Add DataContext Inheritance warning regarding local value assignments. - Add Horizontal/VerticalContentAlignment to Control features. - Clarify Foreground/Background dependency properties on UIElement. - Log action in .jules/codex.md. Co-authored-by: tedd <493224+tedd@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
Updates the project documentation to better describe Tedd.TUI’s WPF-like dependency property mechanics (content alignment and visual styling properties) and DataContext inheritance behavior, with a corresponding entry in the Jules codex.
Changes:
- Documented
HorizontalContentAlignment/VerticalContentAlignmentbeing defined onControland template-bound viaRelativeSource.TemplatedParent. - Documented
Foreground/Backgrounddependency properties being defined onUIElement(withForegroundinherited). - Expanded the
DataContextinheritance documentation and logged the observations/actions in.jules/codex.md.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| README.md | Adds/updates architectural documentation for content alignment DPs, Foreground/Background, and DataContext inheritance propagation. |
| .jules/codex.md | Records the documentation-sync observation/action as a dated codex entry. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| At the heart of Tedd.TUI is the `UIElement` class, which provides the foundation for: | ||
| - **Visual Tree:** A hierarchical structure of elements allowing for complex composition. Any `UIElement` can dynamically ascend the visual tree to resolve its root host via the `GetRoot()` API, enabling recursive topological queries. | ||
| - **HorizontalContentAlignment & VerticalContentAlignment:** To achieve WPF parity for content alignment, `Control` defines `HorizontalContentAlignment` and `VerticalContentAlignment` dependency properties, which are bound to the `HorizontalAlignment` and `VerticalAlignment` of internal `ContentPresenter` elements using `RelativeSource.TemplatedParent` within control templates. | ||
| - **Foreground and Background:** Unlike standard WPF where they reside on `Control`, the `Foreground` and `Background` dependency properties are defined directly on `UIElement`, with `ForegroundProperty` configured to inherit (`isInherited: true`). |
| ### Data Binding | ||
| Tedd.TUI implements a hierarchical data binding infrastructure analogous to WPF, systematically driven by the `DataContext` inherited dependency property. This established framework capability mitigates the need for speculative manual state synchronization. | ||
| - **DataContext Inheritance:** The `DataContext` property is an explicitly defined inherited dependency property. The `DependencyObject` base architecture resolves inherited values by recursively querying `InheritanceParent` (which maps to `Parent` in `UIElement`). Assigning a `DataContext` at the visual root (e.g., `TuiWindow`) makes the data model available to descendant elements that have not set a local `DataContext`. Propagation is implemented in `UIElement.OnPropertyChanged` for inherited dependency properties by enumerating `GetVisualChild` and calling `OnPropertyChanged(dp)` on children that do not have a local value, which in turn updates bindings. | ||
| - **DataContext Inheritance:** The `DataContext` property is an explicitly defined inherited dependency property. The `DependencyObject` base architecture resolves inherited values by recursively querying `InheritanceParent` (which maps to `Parent` in `UIElement`). Assigning a `DataContext` at the visual root (e.g., `TuiWindow`) makes the data model available to descendant elements that have not set a local `DataContext`. Explicit local value assignments on child controls (e.g., within `OnDataContextChanged` overrides or container setters) incorrectly override and break this WPF-isomorphic inheritance mechanism. Propagation is implemented in `UIElement.OnPropertyChanged` for inherited dependency properties by enumerating `GetVisualChild` and calling `OnPropertyChanged(dp)` on children that do not have a local value, which in turn updates bindings. |
| **Observation:** The README.md exhibited documentation drift regarding the newly integrated `Separator` component. It lacked explicit articulation of this control, which inherits from `Control`, explicitly sets `Focusable = false`, and renders a horizontal line using the `\u2500` character to match the DOS-era styling, implementing standard XAML parity for menus and layouts. | ||
|
|
||
| **Strategic Action:** Synchronized the README.md to articulate the `Separator` architecture under the 'Rich Control Suite' section. This ensures epistemological alignment with the current framework capabilities for menu and layout separators. | ||
| ## 2024-07-09 - DataContext Inheritance and Content Alignment |
💡 Target: The Architectural System sections within
README.mdpertaining toUIElementDependency Properties andDataContextinheritance.🎯 Execution: Explicitly delineated internal framework mechanics. Clarified that
HorizontalContentAlignmentandVerticalContentAlignmentexist onControl, and thatForegroundandBackgroundexist directly onUIElementviaisInherited. Furthermore, strictly documented that explicit localDataContextvalue assignments on child controls break the WPF-isomorphic inheritance propagation mechanism. All observations were logged within.jules/codex.md.📊 Epistemological Impact: Eliminated speculative assumptions regarding property resolutions and layout behaviors. The documentation is now precisely synchronized with the current implementation.
🔬 Verification Protocol: Review the updated Markdown rendering of
README.mdto confirm the architectural explanations logically map to the underlying codebase without unsupported claims.PR created automatically by Jules for task 9521067199728259444 started by @tedd