Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binding behavior on Breadcrumbbar has changed in 5.6 #19264

Open
iurycarlos opened this issue Jan 17, 2025 · 1 comment
Open

Binding behavior on Breadcrumbbar has changed in 5.6 #19264

iurycarlos opened this issue Jan 17, 2025 · 1 comment
Assignees
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification

Comments

@iurycarlos
Copy link
Contributor

Current behavior

Fail to correct bind breadcrumb items in different scenarios.

Using a resourced ItemTemplate, breadcrumb will fail to accept pointer events.
Using a local Item content, breadcrumb will fail to construct its items.

App was working perfectly before updating to 5.6

Expected behavior

Breadcrumbbar should be working as expected, accepting click for " ... " when not enough space.

How to reproduce it (as minimally and precisely as possible)

A repro project can be found here:

BreadcrumbBindingBlank.zip

Workaround

Original issue was related to resourced ItemTemplate.
When trying to workaround using local content, we start to get the wrong rendering of items in the flyout.

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

No response

Affected platforms

No response

IDE

No response

IDE version

No response

Relevant plugins

No response

Anything else we need to know?

No response

@iurycarlos iurycarlos added difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification labels Jan 17, 2025
@MartinZikmund
Copy link
Member

MartinZikmund commented Jan 20, 2025

Based on my investigation so far it seems the problem is caused by TemplatedParent in some capacity. Specifically, BreadcrumbBarItem WinUI template uses the following for the individual buttons:

<Button x:Name="PART_ItemButton" x:DeferLoadStrategy="Lazy" ...>
	...
	<!-- This is the Button Content -->
	  <Grid AutomationProperties.AccessibilityView="Raw">
	  <ContentPresenter x:Name="PART_ItemContentPresenter"
	    AutomationProperties.AccessibilityView="Raw"
	    Content="{TemplateBinding Content}"
	    ContentTransitions="{TemplateBinding ContentTransitions}"
	    ContentTemplate="{TemplateBinding ContentTemplate}"
	    FontFamily="{TemplateBinding FontFamily}"
	    FontSize="{TemplateBinding FontSize}"
	    FontWeight="{TemplateBinding FontWeight}"
	    HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
	    VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
	    LineHeight="20" />
	  <TextBlock x:Name="PART_EllipsisTextBlock"
	    AutomationProperties.AccessibilityView="Raw"
	    FontFamily="{ThemeResource SymbolThemeFontFamily}"
	    FontSize="{TemplateBinding FontSize}"
	    Padding="3"
	    Text="&#xE712;"
	    Visibility="Collapsed"
	    VerticalAlignment="Stretch"
	    IsTextScaleFactorEnabled="False" />
	</Grid>
</Button>

Now, this worked before #15672, but after these changes the materialization presumably happens later, so during ElementStub.Materialize the Button gets created with no TemplatedParent initially and you can see that in the logs where you will see:

Applying template binding parent  on Microsoft.UI.Xaml.Controls.ContentPresenter

Note the two spaces after "parent" in the log - this is actually "null". As a result, the ContentPresenter.Content is left null and the buttons are invisible.

I am guessing the TemplatedParent of ContentPresenter needs to be evaluated correctly as BreadcrumbBarItem immediately when the ElementStub materialization happens, as TemplatedParent should remain "constant" throughout the lifecycle. However, I am not sure how to do that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/tbd Categorizes an issue for which the difficulty level needs to be defined. kind/bug Something isn't working triage/untriaged Indicates an issue requires triaging or verification
Projects
None yet
Development

No branches or pull requests

3 participants