IScrollInfo.ScrollOwner 屬性

定義

取得或設定控制捲動行為的 ScrollViewer 項目。

public:
 property System::Windows::Controls::ScrollViewer ^ ScrollOwner { System::Windows::Controls::ScrollViewer ^ get(); void set(System::Windows::Controls::ScrollViewer ^ value); };
public System.Windows.Controls.ScrollViewer ScrollOwner { get; set; }
member this.ScrollOwner : System.Windows.Controls.ScrollViewer with get, set
Public Property ScrollOwner As ScrollViewer

屬性值

控制捲動行為的 ScrollViewer 項目。 此屬性沒有預設值。

範例

下列範例示範如何使用程式碼來設定 ScrollOwner 屬性。

private void onLoad(object sender, System.EventArgs e)
{
    ((IScrollInfo)sp1).CanVerticallyScroll = true;
    ((IScrollInfo)sp1).CanHorizontallyScroll = true;
    ((IScrollInfo)sp1).ScrollOwner = sv1;
}
Private Sub onLoad(ByVal sender As Object, ByVal args As RoutedEventArgs)
    CType(sp1, IScrollInfo).CanVerticallyScroll = True
    CType(sp1, IScrollInfo).CanHorizontallyScroll = True
    CType(sp1, IScrollInfo).ScrollOwner = sv1
End Sub

備註

當屬性變更時,實 IScrollInfo 作的類別必須呼叫 InvalidateScrollInfo 這個物件。

邏輯捲動可讓您捲動至邏輯樹狀結構中的下一個專案。 相反地,實體捲動會以指定的方向來捲動已定義的可測量增量來捲動內容。 如果您需要實體捲動,而不是邏輯捲動,請將主 Panel 元素包裝在 中 ScrollViewer ,並將其 CanContentScroll 屬性值設定為 false

適用於