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

Add fallback to ContentPresenter Content binding using reflection #25992

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

simonrozsival
Copy link
Member

Description of Change

It turns out that for customers that are deriving from TemplatedView run into issues with the ContentPresenter and the binding for the Content property.

  • For customers that don't trim their apps, the fallback to reflection would match the behavior they were experiencing in .NET 8
  • For customers that trim/Native AOT their apps, the fallback likely won't do anything but it also won't produce any warning.

AFAIK we currently don't have any docs that would mention how to implement custom TemplatedView that could be updated to mention that the "proper" way to do this is to implement the object IContentView.Content property in the derived class. I added runtime warning but I'm not sure how many developers will actually see this or just miss it completely.

cc @PureWeen @mattleibow @StephaneDelcroix @davidbritch

Issues Fixed

Fixes #25947

@simonrozsival simonrozsival added the area-xaml XAML, CSS, Triggers, Behaviors label Nov 20, 2024
@simonrozsival simonrozsival requested a review from a team as a code owner November 20, 2024 16:05
@@ -19,12 +21,38 @@ public class ContentPresenter : Compatibility.Layout, IContentView
/// <include file="../../docs/Microsoft.Maui.Controls/ContentPresenter.xml" path="//Member[@MemberName='.ctor']/Docs/*" />
public ContentPresenter()
{
this.SetBinding(
SetBinding(
Copy link
Contributor

Choose a reason for hiding this comment

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

The test RadioButtonWithValueChangeSelected is failing on iOS.
image
Is not rendering the Content, the text.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-xaml XAML, CSS, Triggers, Behaviors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants