diff --git a/src/Avalonia.Controls/Primitives/ScrollBar.cs b/src/Avalonia.Controls/Primitives/ScrollBar.cs index 86bea8daa5..264b944566 100644 --- a/src/Avalonia.Controls/Primitives/ScrollBar.cs +++ b/src/Avalonia.Controls/Primitives/ScrollBar.cs @@ -195,14 +195,15 @@ namespace Avalonia.Controls.Primitives } /// - /// Locates the first 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 and binds to its properties. + /// Properties which have been set through other means are not bound. /// /// /// This method is automatically called when the control is attached to a visual tree. /// internal void AttachToScrollViewer() { - var owner = this.FindAncestorOfType(); + var owner = this.TemplatedParent as ScrollViewer; if (owner == null) {