In our Blazor-App we want to apply the width of an htmle-element by the style
-attribute and an binding:
<div class="progress-bar" style="width: @Progress%;"></div>
@code {
[Parameter]
public int Progress { get; set; }
}
Problem: Visual Studio shows me an warning: "Unexpected character sequence in property value"
This warning has no CL... or BL... code.
Question: What is an elegant way to fix this warning?
I found a possible solution now, based on Henk Holterman´s answer which not shows the warning any more:
<div class="progress-bar" style="width: @($"{Progress}%");"></div>
Blazor sometimes needs a little help to find the C#/HTML border. @(...)
usually does the trick.
<div class="progress-bar" style="width: @(Progress)%;"></div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With