-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Conversation
RowDefinitions="Auto, *, Auto"> | ||
<Grid.Resources> | ||
|
||
<DataTemplate x:Key="SampleItemTemplate"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
foreach (var item in ListViewBase.GetChildren<ItemContentControl>()) | ||
{ | ||
item.ItemHeight = GetItemHeight(); | ||
item.ItemWidth = GetItemWidth(); |
There was a problem hiding this comment.
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
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


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