title: How to update classes on binded variable update in Blazor
body: <p>I have a binded span value on one of my object property</p>
  
  <pre><code>&lt;span class="badge badge-primary"&gt;@MyObject?.MyProperty&lt;/span&gt;
  </code></pre>
  
  <p>I want to be able to update my span classes in respect to it's content (the binded variable)</p>
  
  <p>The only way I can think of is to bind the variable a second time inside an attribute of the span and declare my css classes accordingly</p>
  
  <pre><code>&lt;span class="badge badge-primary" value="@MyObject?.MyProperty"&gt;@MyObject?.MyProperty&lt;/span&gt;
  </code></pre>
  
  <pre><code>.badge[value="myvalue"]{
      background-color:white;
  }
  </code></pre>
  
  <p>The issue with this approch is that</p>
  
  <ul>
  <li>It require me to re-define custom classes for each value when I already have classes in my css framework i could use</li>
  <li>It can only be applied to a finite list of predefined value</li>
  <li>I can't use a more comple analysis of my value to descide which class to apply (like checking the value with a regex for exemple)</li>
  </ul>
  
  <p>As I'm a bit new to MVVM and data binding, is there a "right" way to do that ?</p>