Browse Source

Merge pull request #12732 from liwuqingxin/fixes/12482-datagrid-scroll

Fix the scrollbar attaching to wrong scrollviewer, like scrollviewer …
focus_prototype
Max Katz 3 years ago
committed by GitHub
parent
commit
fdf27e16a1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/Avalonia.Controls/Primitives/ScrollBar.cs

5
src/Avalonia.Controls/Primitives/ScrollBar.cs

@ -195,14 +195,15 @@ namespace Avalonia.Controls.Primitives
} }
/// <summary> /// <summary>
/// Locates the first <see cref="ScrollViewer"/> ancestor and binds to its properties. Properties which have been set through other means are not bound. /// Try to attach to TemplatedParent if it is a <see cref="ScrollViewer"/> and binds to its properties.
/// Properties which have been set through other means are not bound.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// This method is automatically called when the control is attached to a visual tree. /// This method is automatically called when the control is attached to a visual tree.
/// </remarks> /// </remarks>
internal void AttachToScrollViewer() internal void AttachToScrollViewer()
{ {
var owner = this.FindAncestorOfType<ScrollViewer>(); var owner = this.TemplatedParent as ScrollViewer;
if (owner == null) if (owner == null)
{ {

Loading…
Cancel
Save