-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[templates] do not use 'required' in xaml controls #31564
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
Conversation
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.
Pull Request Overview
This PR addresses a compatibility issue with the required keyword in XAML controls within .NET MAUI templates. The runtime XAML and XamlC systems ignore required fields and properties, making the compiler check ineffective. The change replaces compile-time required validation with runtime null checks.
- Removes
requiredmodifiers from DataTemplate properties in ChipDataTemplateSelector - Adds runtime null validation with descriptive error messages when templates are accessed
src/Templates/src/templates/maui-mobile/Pages/Controls/ChipDataTemplateSelector.cs
Outdated
Show resolved
Hide resolved
src/Templates/src/templates/maui-mobile/Pages/Controls/ChipDataTemplateSelector.cs
Outdated
Show resolved
Hide resolved
Runtime XAML and XamlC inflators ignore the required fields and props. XSG can do it in soem cases but fails for complex, or long references. Replace the compiler check (ignored) by a runtime check
3f82e8e to
e2a9e90
Compare
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.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
|
We need to also update this in the maui-samples repo |
src/Templates/src/templates/maui-mobile/Pages/Controls/ChipDataTemplateSelector.cs
Outdated
Show resolved
Hide resolved
…aTemplateSelector.cs
Runtime XAML and XamlC inflators ignore the required fields and props. XSG can do it in soem cases but fails for complex, or long references. Replace the compiler check (ignored) by a runtime check