Implement VerticalContentAlignment for DatePicker and TimePicker - #21464
Merged
MrJul merged 4 commits intoAug 19, 2026
Conversation
This change registers VerticalContentAlignmentProperty as a StyledProperty using ContentControl's property as the owner for both DatePicker and TimePicker controls to maintain framework consistency. Basic xUnit v3 unit tests are introduced to validate property round-trips (Top, Center, Bottom, Stretch) and to ensure the default value correctly resolves to Stretch. This establishes the necessary C# infrastructure before modifying the control templates. Part of AvaloniaUI#21211: implment fluent theme layout
- Bind internal grids to VerticalContentAlignment in Fluent and Simple themes for DatePicker and TimePicker controls. - Add comprehensive integration tests using mocked NameScopes in DatePickerTests and TimePickerTests to verify visual propagation. - Validate visual layout correctness using the ControlCatalog app. Closes AvaloniaUI#21211
|
You can test this PR using the following package version. |
|
You can test this PR using the following package version. |
MrJul
requested changes
Aug 19, 2026
MrJul
left a comment
Member
There was a problem hiding this comment.
LGTM in general, some tests that aren't testing anything need to be removed, though.
MrJul
enabled auto-merge
August 19, 2026 14:24
|
You can test this PR using the following package version. |
MrJul
added a commit
to MrJul/Avalonia
that referenced
this pull request
Sep 2, 2026
…loniaUI#21464) * Add VerticalContentAlignment property to DatePicker and TimePicker This change registers VerticalContentAlignmentProperty as a StyledProperty using ContentControl's property as the owner for both DatePicker and TimePicker controls to maintain framework consistency. Basic xUnit v3 unit tests are introduced to validate property round-trips (Top, Center, Bottom, Stretch) and to ensure the default value correctly resolves to Stretch. This establishes the necessary C# infrastructure before modifying the control templates. Part of AvaloniaUI#21211: implment fluent theme layout * Fix VerticalContentAlignment bindings and integration tests - Bind internal grids to VerticalContentAlignment in Fluent and Simple themes for DatePicker and TimePicker controls. - Add comprehensive integration tests using mocked NameScopes in DatePickerTests and TimePickerTests to verify visual propagation. - Validate visual layout correctness using the ControlCatalog app. Closes AvaloniaUI#21211 * Remove tautological tests --------- Co-authored-by: Martim Claudino <martimffclaudino@tecnico.ulisboa.pt> Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does the pull request do?
This PR implements the VerticalContentAlignment property for both DatePicker and TimePicker controls. This allows developers to easily align the internal text and component selectors vertically without having to duplicate or override the default control templates.
What is the current behavior?
The internal content and textual selectors of the DatePicker and TimePicker controls have a fixed vertical position, meaning they do not respond to custom vertical alignment adjustments when the control height is increased.
What is the updated/expected behavior with this PR?
The internal text and selectors now dynamically bind and respond to the VerticalContentAlignment property. To verify the behavior at runtime, you can launch the ControlCatalog.Desktop sample, target the DatePicker or TimePicker controls, and inspect their visual tree using the Avalonia DevTools inspector to verify that the TemplateBinding propagates the alignment properties correctly down to the internal layout structures.
How was the solution implemented (if it's not obvious)?
Checklist
Breaking changes
None.
Obsoletions / Deprecations
None.
Fixed issues
Fixes #21211