Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More precise VirtualizingStackPanel #17831

Open
xiejiang2014 opened this issue Dec 25, 2024 · 2 comments
Open

More precise VirtualizingStackPanel #17831

xiejiang2014 opened this issue Dec 25, 2024 · 2 comments

Comments

@xiejiang2014
Copy link

Is your feature request related to a problem? Please describe.

Currently, some methods are used in VirtualizingStackPanel to estimate the size. This causes the scroll position of the virtualized list to be not accurate at the pixel level.

Describe the solution you'd like

Add some virtual functions to VirtualizingStackPanel, let the subclass override these virtual functions, and accurately calculate various sizes according to actual needs. This allows pixel-accurate scrolling in the virtualized list.

Describe alternatives you've considered

No response

Additional context

No response

@stevemonaco
Copy link
Contributor

stevemonaco commented Dec 25, 2024

Most controls will not have an accurate size until created and placed into a layout which renders the core feature of virtualization (limiting instantiation of real controls) pointless.

There is some room to improve these scenarios (when using ItemsSource to generate children):

  1. fixed height rows for all items. (estimator should work fine here)
  2. fixed heights calculated based on the item type or state.

Scenario 2 would require a full enumeration of the source collection with some additional complexities when child controls are removed/added.

@timunie
Copy link
Contributor

timunie commented Dec 26, 2024

In Avalonia.Labs I experiment with VirtualizingWrapPanel. For different ItemSizes there is is an interface IItemSizeProvider which can be implemented to estimate ItemSize by clients. It still will require a loop over each item which may be slow for huge collections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants