-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Provide a pure code model for creating and working with Blazor components #44866
Comments
Thanks for contacting us. We're moving this issue to the |
I love this idea! |
I think It'd be great for .net developers to be able to develop both web and native applications with one unified language(Razor syntax). In fact, the reason that .Net Maui hasn't lived up to the expectations of many developers somehow has to do with XMAL, which is pretty hard to work with. The way binding works in XAML has a lot to be desired for since it's string-based and most often you would have no idea whether the binding works or not until the app runs! |
Blazor is much simpler and more productive than XAML. I think C# and .NET are very good ecosystems. My team chose Flutter because XAML is difficult and unproductive, but I haven't given up on developing apps in C# yet. |
I wonder what are technical difficulties here. One that I know is assigning sequence numbers when adding markup or elements. When I did similar code-first wrapper in F# I've found no true reliable way to do this. It's hard to compete with proper compiler after all. Other thing is that Razor compiler can infer what is markup and what is not and optimize huge markup blocks in one go. Not sure how to do this with code approach unless doing manually. What are the others? |
For comparison, the .NET MAUI Community Toolkit introduced what they call C# Markup as "a set of fluent helper methods and classes designed to simplify the process of building declarative .NET Multi-platform App UI (.NET MAUI) user interfaces in code". |
It would be life saving thing. Neither razor nor XAML is as pleasant to write as C# |
C# Markup is great. But it uses mvvm app model. But for MVU C# app model, Comet is amazingly excellent. It is very simple and powerful |
@danroth27 thanks for proposing to invest in the developer experience of C# UI👍 I've been championing and contributing to improve the developer experience for C# UI for .NET UI frameworks for many years - perhaps we can work together on this for Blazor? Background:I'm the author of above mentioned C# Markup 1 (which I contributed to Xamarin Forms and later to Xamarin.CommunityToolkit.Markup, which is now ported to CommunityToolkit.Maui.Markup) I'm also author of next-gen C# Markup 2, currently for Windows App SDK, Uno Platform and WPF. In this recent poll devs voted for MAUI to be added next: C# Markup 2 for Blazor has tentatively been on my roadmap for a while, I did some research on how to implement that. I'd be happy to have a conversation about this - lmk thx |
I really hope the XAML interface dies off. Tried it heavily in Silverlight and it should have died after that. Please move towards a standardized approach and deprecate XAML in MAUI. Never going to use it. Blazor is a much superior approach. |
In fact, we have almost everything for such a possession. there are Blazor components. All widgets in Blazor components should be expected. Here is a great example It is worth noting that it will be necessary to refine the attached properties and behavior. All this can be implemented through the slot. |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
This sounds like such a neat idea. Would love to see it in .NET 8! |
like blazor |
Any update on this wonderful idea? |
The issue is in the backlog and .NET 8 is done. This area isn’t a priority for the team. |
Thank you for the response David. |
I don’t know but I’d say it’s unlikely. I could be wrong but I don’t think this is “the thing” that will make Blazor appeal to the masses. As much as I love the idea of a code based model, it unclear that this level of investment would pay off. That said, if a group of people think this is the missing piece of the blazor puzzle, I’d encourage you to work together on coming up with what a concrete proposal would look like. |
My motivation for this is more about MAUI than it is about Blazor. Blazor's Razor syntax is already pretty amazing for .NET developers (I love it!) but for developers coming from other programming languages like Swift, Flutter etc. this will be very nice (as they don't even have to learn Razor, just C# would suffice) but for MAUI development, this will be a game changer. Also see this. |
Maybe you can try Comet C# MVU - it is a .NET Maui library for developing apps using C# only. It has great binding and grid system and it makes developing apps easier. Comet or you can try ReactorUI |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
like blazor |
Interesting frameworks (MVUs) but unlikely to be accepted/approved by big enterprises (learning curve/dependencies/risk). XAML is legacy and I've ended up here because, like everyone else, I have been looking for a way out. In my opinion the right approach (investment) by MSFT is to go with a unified syntax (razor - blazor is widely successful) as mentioned above. This would improve mobile and web app development velocity by orders of magnitude, especially for the enterprise, whilst at the same time making everyone happy. Mobile Blazor Bindings FTW! |
MVU pattern is more simple and easier to learn compare to anything mvvm or xaml could offer. |
Blazor components today are typically authored using Razor syntax, which is designed to make it convenient to define dynamic HTML rendering logic using a combination of HTML and C#. You can define Blazor components directly in C# code, but then you're working directly with the
RenderTreeBuilder
which is more designed as a compiler target than a user-friendly API. While it's not super common to build Blazor components directly in code, it is done (we build that built-in Blazor components this way) and the user experience could be substantially improved.There may also be an opportunity here to reuse this work to help .NET MAUI. .NET MAUI is exploring providing a programming model that is not XAML based in order to appeal to a broader developer audience. Comet was built as one potential approach. We also explored in the Mobile Blazor Bindings (MBB) experimental project using Razor syntax and Blazor components to work with native UI as an alternative to XAML. While this model potentially appeals to existing Blazor users, using Razor markup syntax for native components arguably has limited value in that there is no inherent markup language for native components. We're effectively inventing another one (like XAML).
If we had a pure code model for working with Blazor components we could potentially still use the work from the Mobile Blazor Bindings to wrap native component and then use the Blazor component model to compose native UI without the need for markup at all. This approach may appeal to existing Flutter and Swift UI developers that are used to building UI with a fluent style programming model.
The text was updated successfully, but these errors were encountered: