Skip to content

Conversation

gentledepp
Copy link
Contributor

Fixes #76

It works for me - please let me know if I forgot something!

@gentledepp
Copy link
Contributor Author

@OmidID any plans to merge this? :-D

@OmidID OmidID requested a review from Copilot July 15, 2025 19:46
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment on lines 55 to +56
FontSize="14"
HorizontalAlignment="Center"></TextBlock>
HorizontalAlignment="Center"></ContentControl>
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

{
itemPresenter.DataContext = element.DataContext ?? element;
itemPresenter[!ContentControl.ContentProperty] = element[!HeaderProperty];
itemPresenter[!ContentControl.ContentTemplateProperty] = element[!HeaderTemplateProperty];
Copy link

Copilot AI Jul 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Using a control as NavigationBar.Header or .HeaderIcon causes runtime exception
1 participant