ListBox.ScrollIntoView(Object) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會讓該物體捲入畫面。
public:
void ScrollIntoView(System::Object ^ item);
public void ScrollIntoView(object item);
member this.ScrollIntoView : obj -> unit
Public Sub ScrollIntoView (item As Object)
參數
- item
- Object
物件可捲動。
範例
以下範例說明如何使用 ScrollIntoView 此方法將清單框中的項目捲動到視窗中。
private void ScrollIntoView(object sender, RoutedEventArgs e)
{
var index = cbScrollIntoView.SelectedIndex;
var item = lbScrollIntoView.Items.GetItemAt(index);
lbScrollIntoView.ScrollIntoView(item);
}
Private Sub ScrollIntoView(ByVal sender As Object, ByVal e As RoutedEventArgs)
Dim index = cbScrollIntoView.SelectedIndex
Dim item = lbScrollIntoView.Items.GetItemAt(index)
lbScrollIntoView.ScrollIntoView(item)
End Sub
備註
如果物件不可見,則會將其對齊在視窗的頂部或底部。