[Proposal] Consider adding Fluent API / Markup style methods for the types defined in the Toolkit similar to that of existing Markup package for the Core #262
Replies: 3 comments 5 replies
-
Thanks @egvijayanand! I’ve converted this to a Discussion because we can’t open a Proposal until we have a Detailed Design and API surface completed. This discussion may be better suited for CommunityToolkit.Maui.Markup: https://github.com/communitytoolkit/maui.markup |
Beta Was this translation helpful? Give feedback.
-
Thanks, @brminnick. The reason why I opened this issue here in this repo is since the Markup package is for the Core features and the request is for types in the CommunityToolkit. Let me know your thoughts. |
Beta Was this translation helpful? Give feedback.
-
Closed as per the Community Stand-up discussion here: https://youtu.be/N9wMcBP4jtg?t=2889 |
Beta Was this translation helpful? Give feedback.
-
Fluent API / Markup style methods for the types defined in the Toolkit, wherever feasible
Link to Discussion
Summary
Fluent API / Markup style methods for the types defined in the Toolkit, wherever feasible, are productivity boosters especially for those developing mainly with C# and coming from other backgrounds with no or less XAML knowledge.
Motivation
Already there exists a Markup package with support for the core features but there is none for the types in the Toolkit.
Detailed Design
We can start with adding fluent types for basic features such as Semantics, Attached Properties, and keep adding them incrementally to get up to speed.
Usage Syntax
In the below code sample,
SemanticHeading()
andSemanticDesc()
is proposed fluent APIs. Similar ones need to be explored and added to the Toolkit.Note: Since Semantics is now included as a core feature in .NET MAUI, these specific APIs need to be added to the
CommunityToolkit.Maui.Markup
package and shown as a sample to describe the proposal.Drawbacks
The APIs need to be refreshed whenever there is a design change.
Alternatives
The classic approach of creating types with C# with instances and linking them. Have tried a similar thing for defining a Shell page in both the approaches (with and without such APIs).
Adding a few such simple methods resulted in saving hundreds of keystrokes and code became much more readable.
Unresolved Questions
The scope of the APIs that need to be added for the available types.
If any automation is possible, can be done to scan the types, generate those APIs, verify, and include them in the package.
Beta Was this translation helpful? Give feedback.
All reactions