Introduced attached HeaderIconTemplate and HeaderTemplate properties#77
Introduced attached HeaderIconTemplate and HeaderTemplate properties#77gentledepp wants to merge 1 commit intoAvaloniaInside:developfrom
Conversation
|
@OmidID any plans to merge this? :-D |
There was a problem hiding this comment.
Pull Request Overview
This PR introduces templating capabilities for navigation headers by adding HeaderTemplate and HeaderIconTemplate attached properties to the NavigationBar class. This enhancement allows for more flexible customization of how headers and header icons are displayed in the navigation interface.
- Added HeaderTemplate and HeaderIconTemplate attached properties to NavigationBar class
- Updated TabPage template to use ContentControl instead of ContentPresenter/TextBlock for template support
- Modified UpdateHeader method to bind the new HeaderTemplate property
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| NavigationBar.cs | Added HeaderTemplate and HeaderIconTemplate attached properties and updated UpdateHeader method to support templating |
| TabPage.axaml | Changed from ContentPresenter/TextBlock to ContentControl elements to enable template binding for headers and icons |
| FontSize="14" | ||
| HorizontalAlignment="Center"></TextBlock> | ||
| HorizontalAlignment="Center"></ContentControl> |
There was a problem hiding this comment.
The FontSize property is applied to a ContentControl but may not be effective since ContentControl doesn't directly render text. Consider moving this property to the ContentTemplate or removing it if the template should handle text styling.
| { | ||
| itemPresenter.DataContext = element.DataContext ?? element; | ||
| itemPresenter[!ContentControl.ContentProperty] = element[!HeaderProperty]; | ||
| itemPresenter[!ContentControl.ContentTemplateProperty] = element[!HeaderTemplateProperty]; |
There was a problem hiding this comment.
The HeaderIconTemplate property is not being bound in the UpdateHeader method, creating inconsistency with the HeaderTemplate implementation. Consider adding a similar binding for HeaderIconTemplate if this method handles icon updates.
Fixes #76
It works for me - please let me know if I forgot something!