Comments (4)
Hi @AnaStepic - thanks for bringing this to my attention.
Are you able to reproduce this in a minimalstic project that you can provide me for debugging?
from blazor-dragdrop.
Yes. I just created a new Blazor project in Visual Studio and installed Drag & Drop.
I edited Index.razor and created two components: MyComponent & Card
If you run the program, you'll see these two cards:
Both the left and right cards have the exact same code. The only difference is that in the left card, that code is placed in MyComponent.razor, while in the right case, the code is pasted in the Index.razor
If you click on "Click me to toggle state", the text below should change. And it does, on the right card, but not on the left. If you put a breakpoint in the code, you'll see that the click method does get called, but the rendering of the card isn't updated. It won't update even if you call StateHasChanged()
Index.razor:
@page "/"
<div class="row">
<div class="col">
<Dropzone Class="row" Name="Column1">
<MyComponent />
</Dropzone>
</div>
<div class="col">
<Dropzone Class="row" Name="Column2">
<Card Title="Card">
<a @onclick="Clicked">Click Me To Toggle State</a>
@if (_toggle)
{
<p class="text-danger">I have been toggled</p>
}
else
{
<p class="text-primary">I have not yet been toggled</p>
}
</Card>
</Dropzone>
</div>
</div>
@code{
bool _toggle = true;
void Clicked()
{
_toggle = !_toggle;
}
}
MyComponent:
<Card Title="My Component">
<a @onclick="Clicked">Click Me To Toggle State</a>
@if (_toggle)
{
<p class="text-danger">I have been toggled</p>
}
else
{
<p class="text-primary">I have not yet been toggled</p>
}
</Card>
@code {
bool _toggle = true;
void Clicked()
{
_toggle = !_toggle;
}
}
Card:
<Draggable AllOtherAttributes="@_attributes" Name="@Title">
<div class="card shadow mb-2">
<div class="card-header">
<h6 class="m-0 font-weight-bold @TitleColor">@Title</h6>
</div>
<div class="card-body">
@ChildContent
</div>
</div>
</Draggable>
@code {
[Parameter]
public string TitleColor { get; set; } = "text-primary";
[Parameter]
public string Title { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
Dictionary<string, object> _attributes => new Dictionary<string, object>() { { "class", "col-12 dashboard-card" } };
}
The VS solution:
Test.zip
from blazor-dragdrop.
@AnaStepic I can reproduce the error.
If you change your code to
<Draggable>
<MyComponent />
</Draggable>
(and remove the draggable from the card component)
you can fix the issue.
Unfortunately, there is no short-term fix to make it work otherwise.
from blazor-dragdrop.
I see. So have to avoid putting draggable further down in the component hierarchy and figure out a way around it if needed.
from blazor-dragdrop.
Related Issues (20)
- Startup.cs vs Program.cs and ActiveItem equals null HOT 2
- not working in newest chrome release HOT 2
- Blazor Server .NET 6 mobile drag n drop HOT 1
- Multiple Dropzone and Linq Items not work
- Doesn't work on mobile? OnItemDrop never triggers. HOT 4
- CSS grid support HOT 3
- .NET 6.0 Program.cs
- Doesn`t work with MAUI Blazor HOT 1
- inprogess / inprogress misspellings
- File drop possible?
- DropZone - when you incidentally start dragging dropzone caption down, after that dragging an item shows dragging all items HOT 1
- Cannot add new/remove items to list when one item was dragged from one list to another HOT 1
- [Question] OrderPossiton not Available ? HOT 6
- Support for handle
- How to use it with Virtualization?
- Stop drop if item belongs to another dynamically created dropzone of same type?
- Read the order position of list items
- [Question] Multiple drops of single item
- [Feature Request] Expose containing div HOT 1
- website with examples is stopped HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from blazor-dragdrop.