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
ScrollViewer isn't consistently anchoring the viewport to track a growing extent #562
Comments
What a ride 😲. Then this bug.. Again back to the attached properties, but in the end I gave up on them 🤧, set the /// <summary>
/// This is a workaround for https://github.com/Microsoft/microsoft-ui-xaml/issues/562
///
/// When the issue is fixed, ScrollViewers can be set to VerticalAnchorRatio="1"
/// </summary>
public static class ScrollViewerExtensions
{
public static void EnableAutoscroll(this ScrollViewer scroller)
{
FrameworkElement content = scroller.Content as FrameworkElement;
if (content == null)
{
throw new NullReferenceException("ScrollViewer has no content to monitor for size changes.");
}
bool _autoScroll = true;
scroller.ViewChanged += delegate
{
// autoscroll only if the view-changed stopped at the end
_autoScroll = scroller.ScrollableHeight - scroller.VerticalOffset < 0.1;
};
content.SizeChanged += delegate
{
if (_autoScroll)
{
scroller.ChangeView(null, scroller.ExtentHeight, null);
}
};
}
} |
Thanks for the report @michaelosthege and sorry for the troubles. I am not sure how quickly we will be able to investigate this. In the meantime, I am concerned about the strict equality above, scroller.VerticalOffset == scroller.ScrollableHeight, because of rounding errors. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days. |
@RBrid was this maybe taken care of in the meantime? |
Describe the bug
When scrolled to the bottom of a list with a ScrollViewer that is configured to anchor at the extent (VerticalAnchorRatio = 1.0) then the viewport should automatically shift to track the very end, but it doesn't always.
Steps to reproduce the bug
Steps to reproduce the behavior:
Expected behavior
The newly added messages at the bottom of the list should always appear in view.
Actual behavior
The viewport may not automatically shift so that the message doesn't appear in view and at that point it tracks what is in view so that all subsequent messages continue to appear below the fold.
Version Info
NuGet package version:
Microsoft.UI.Xaml 2.1.190405004]
The text was updated successfully, but these errors were encountered: