question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Improvement] `ListBox.draggable`-Style should not disable virtualization

See original GitHub issue

Hi @wieslawsoltes

first of all this library is really really useful and I am happy with the state it is. 😄 However when I tested some performance in my App and I noticed that adding several hundred or thousand items to a ListBox.draggable makes the UI nearly unusable. After having a deeper look I noticed that virtualization is disabled in the Styles-Section:

  <Style Selector=":is(ListBox).draggable">
    <Setter Property="ItemsPanel">
      <Setter.Value>
        <ItemsPanelTemplate>
          <StackPanel Orientation="Vertical" />
        </ItemsPanelTemplate>
      </Setter.Value>
    </Setter>
  </Style>

If I replace the StackPanel with VirtualizingStackPanel it works, but dragging an item and scrolling is buggy (I think this is the reason for disabling virtualization?)

I know that I can add my own logic which I already do (I use adorner instead of transforms) but maybe others will face the same issue also, that is why I decided to open this ticket here. If I find a good solution I’ll open a PR for this.

Happy coding Tim

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14

github_iconTop GitHub Comments

1reaction
wieslawsoltescommented, Nov 25, 2021

@timunie Thanks for repro. I am working on fix and other improvements here https://github.com/wieslawsoltes/AvaloniaBehaviors/pull/85

0reactions
timuniecommented, Nov 30, 2021

I think it requires handling item container generator event (materialize, dematerialize etc.) and handle new containers.

Yes, maybe that is a good idea to do. I have to learn more about this

I think the scrolling needs to be handled also in some way as the RenderTransform needs to be adjusted accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · AvaloniaUI/Avalonia.Xaml.Behaviors
It's impossible to press button or choice combobox item when I'm using ... [Improvement] ListBox.draggable -Style should not disable virtualization bug.
Read more >
WPF ListView virtualization. How to disable ...
I have some troubles with custom ListView (CheckBoxes inside lost their states when scrolling ListView). Can I disable ListView virtualization ...
Read more >
Is it OK to disable virtualization? - Old School Gamers
Yes, enabling virtualization is generally safe. Virtualization technology is used to create virtual machines (VMs) that can run multiple operating systems on a ......
Read more >
ListBoxEdit Virtualization
Hi,. I'm attempting to use the ListBoxEdit, mostly to take advantage of the drag drop support available via the ListBoxDragDropBehavior.
Read more >
Enable or Disable Virtualization-based Security on an ...
You can enable Microsoft virtualization-based security (VBS) on existing virtual machines for supported Windows guest operating systems.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found