-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
Getting Component Attributes Do Not Support Complex Content (mixed c# and markup) #29121
Comments
Thanks for contacting us. Can you point to a specific line in your code indicating the behavior you'd like to work, where it currently doesn't? |
The line of code I would like to work is this
the @ symbol means that a variable is coming from c#. |
@NTaylorMullen do you have an issue we can dupe this with? |
Nope no issue. This was an intentional limitation early on in Blazor development to reduce the complexity of the system. Mixing content is a tough problem because of the implications it imposes on when/if to encode and how to buffer the entire content of the attribute performantly and still hand it off in a reasonable form to a consumer |
You can always achieve this by using |
Do you think its possible the tooling can be updated that if doing that way, the intellisense can still work. |
The mixing worked fine though when using standard div. If regular divs work, then shouldn't it work the same way if using a component instead of a standard div? |
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. |
Thanks for reporting, closing as duplicate of dotnet/razor#7684. |
Here is my repository where the problem is duplicated each time.
https://github.com/musictopia2/ComplexContentBugSample
Either this is a bug or a new feature that is needed.
There are cases where somebody may use a custom component that accepts styles to make it more flexible.
If using divs, it works perfectly as you can see in my repository. I need it working even with custom components.
It would be okay if it somehow only worked when using standard class or style by splatting.
This is one case where its important to be able to mix c# into the string. If any other way is done, then you lose the intellisense for the styles which hurts productivity and makes it more likely to introduce errors as well.
I found out that early versions of blazor did not even support mixing c# for strings for divs. This same thing needs to happen even if its a custom component at least if using class and style via splatting.
The text was updated successfully, but these errors were encountered: