'C# Blazor - draggable using a variable not working

My drag and drop functionality works with the following html section:

<div class="outer" ondragover="event.preventDefault();">
   @foreach (CustomObject o in ObjectList)
   {
      <div draggable="true" @key="o.Rank" @ondrag="@(()=> StartDrag(o))" @ondrop="@(()=> Drop(o))" class="inner">
      ...
      </div>
   }
</div>

But I want to make "draggable" work with a variable so I can turn it on and off.

In my code section I add:

private bool isDraggable = true;

All of the following don't allow for the drag and drop functionality to work:

draggable="isDraggable"
draggable="@isDraggable"
draggable=isDraggable
draggable=@isDraggable

Is there something I am missing here? or can you just flat out not make draggable work with a variable??



Solution 1:[1]

Finally figured it out:

draggable="@isDraggable.ToString()"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeremy P