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

[Windows] Avoid Carousel changes the current position when window is resized #22222

Merged
merged 10 commits into from
May 8, 2024

Conversation

jsuarezruiz
Copy link
Contributor

@jsuarezruiz jsuarezruiz commented May 6, 2024

Description of Change

Avoid Carousel changes the current position when window is resized.

The problem is that, every time we change the size of the CarouselView (due to window size change, change in layouts, etc.) we are: reloading the ItemsSource, making adjustments to snap, making adjustments to center CurrentItem, etc. This has an important impact on performance in addition to being able (as you can see in the gif below) to change and set an incorrect CurrentItem.

Before
issue-22000
After
fix-22000

Issues Fixed

Fixes #22000
Fixes (partially) #18559
Related with #18014 (the issue contains more than one specific problem)

@jsuarezruiz jsuarezruiz added t/bug Something isn't working platform/windows 🪟 legacy-area-perf Startup / Runtime performance area-controls-collectionview CollectionView, CarouselView, IndicatorView labels May 6, 2024
@jsuarezruiz jsuarezruiz requested a review from a team as a code owner May 6, 2024 11:23
@jsuarezruiz jsuarezruiz requested review from mattleibow and PureWeen May 6, 2024 11:23
RowDefinitions="Auto, *, Auto">
<Grid.Resources>

<DataTemplate x:Key="SampleItemTemplate">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue-22000-test

foreach (var item in ListViewBase.GetChildren<ItemContentControl>())
{
item.ItemHeight = GetItemHeight();
item.ItemWidth = GetItemWidth();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's beyond the scope of this PR, but I wonder why this logic isn't in the layout/measure pass. You'd think that item width + height is just calculated based on horizontal/vertical modes

@jsuarezruiz jsuarezruiz requested a review from PureWeen May 7, 2024 11:41
@rmarinho rmarinho requested a review from Foda May 7, 2024 13:41
@PureWeen PureWeen merged commit 4a1cc39 into main May 8, 2024
49 checks passed
@PureWeen PureWeen deleted the fix-22000 branch May 8, 2024 17:10
@Eilon Eilon added t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf) and removed legacy-area-perf Startup / Runtime performance labels May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-collectionview CollectionView, CarouselView, IndicatorView fixed-in-8.0.40 fixed-in-9.0.0-preview.5.24307.10 platform/windows 🪟 t/bug Something isn't working t/perf The issue affects performance (runtime speed, memory usage, startup time, etc.) (sub: perf)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Windows] Carousel changes the current position when window is resized
5 participants