-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[XC] Produce warning when x:DataType is inherited from outer scope of DataTemplate
#22803
[XC] Produce warning when x:DataType is inherited from outer scope of DataTemplate
#22803
Conversation
if (n.XmlType.Name == nameof(Microsoft.Maui.Controls.DataTemplate) | ||
&& n.XmlType.NamespaceUri == XamlParser.MauiUri) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any other types of scopes we would need future changes for?
Wondering if any of these have an issue:
ResourceDictionary
ControlTemplate
In theory, you could have a {Binding}
inside a Style
in a {ResourceDictionary}
and the type could be different based on the XAML using the Style
? Maybe the existing warning already works for this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this applies to ResourceDictionary (BTW we're not compiling these bindings at the moment: #22023), but it might apply to ControlTemplate 🤔 In general, this should be whenever there's a different BindingContext in the outer scope and in the inner scope. What do you think, @StephaneDelcroix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the other cases we can check in the future.
Sorry needs rebase |
ea44d26
@rmarinho @jonathanpeppers do you think we can go ahead with this PR? There are currently no merge conflicts. |
Description of Change
Produces the following warning:
Issues Fixed
Fixes #22714
/cc @StephaneDelcroix @jonathanpeppers @PureWeen @mattleibow