Metoda DataRepeater.ScrollItemIntoView — (Int32)

Przesuwa się z określonym DataRepeaterItem do widoku w DataRepeater kontroli.

Przestrzeń nazw:  Microsoft.VisualBasic.PowerPacks
Zestaw:  Microsoft.VisualBasic.PowerPacks.Vs (w Microsoft.VisualBasic.PowerPacks.Vs.dll)

Składnia

'Deklaracja
Public Sub ScrollItemIntoView ( _
    index As Integer _
)
public void ScrollItemIntoView(
    int index
)
public:
void ScrollItemIntoView(
    int index
)
member ScrollItemIntoView : 
        index:int -> unit
public function ScrollItemIntoView(
    index : int
)

Parametry

Wyjątki

Wyjątek Warunek
ArgumentOutOfRangeException

Wartość określona dla index jest mniejszy niż 0 lub większa niż ItemCount - 1.

Uwagi

Wywołanie ScrollItemIntoView metodę w celu wyświetlenia określonej DataRepeaterItem w widoczną część formantu.Element nie zostanie wybrany.Aby wybrać element, należy ustawić CurrentItemIndex właściwości.

Element zostanie przewijane do widoku w minimalna algorytm przewijania; jego będzie nie musi być można wyrównane do górnej krawędzi formantu.Aby wyrównać element z góry formantu, należy wywołać przeciążenia ScrollItemIntoView metody z alignWithTop ustawionym na true.

Przykłady

Poniższy przykładowy kod pokazuje, jak utworzyć pierwszego elementu wyświetlanego obecnie wybrany element w DataRepeater kontroli.Przyjęto założenie, że formularz, który zawiera DataRepeater formantu o nazwie DataRepeater1 i Button formantu o nazwie SynchButton.

Private Sub SynchButton_Click() Handles SynchButton.Click
    ' If the first displayed item is not the current item. 
    If DataRepeater1.FirstDisplayedItemIndex <> 
      DataRepeater1.CurrentItemIndex Then 
        ' Make it the current item.
        DataRepeater1.CurrentItemIndex = 
          DataRepeater1.FirstDisplayedItemIndex
        ' Align it with the top of the control.
        DataRepeater1.ScrollItemIntoView( 
          DataRepeater1.FirstDisplayedItemIndex, True)
    End If 
End Sub
private void synchButton_Click(System.Object sender, System.EventArgs e)
{
    // If the first displayed item is not the current item. 
    if (dataRepeater1.FirstDisplayedItemIndex != dataRepeater1.CurrentItemIndex)
    // Make it the current item.
    {
        dataRepeater1.CurrentItemIndex = dataRepeater1.FirstDisplayedItemIndex;
        // Align it with the top of the control.
        dataRepeater1.ScrollItemIntoView(dataRepeater1.FirstDisplayedItemIndex, true);
    }
}

Zabezpieczenia programu .NET Framework

Zobacz też

Informacje

DataRepeater Klasa

Przeciążenie ScrollItemIntoView

Przestrzeń nazw Microsoft.VisualBasic.PowerPacks

CurrentItemIndex

FirstDisplayedItemIndex

Inne zasoby

Wprowadzenie do formantu DataRepeater (Visual Studio)

Porady: wyszukiwanie danych w formancie DataRepeater (Visual Studio)