CollectionView.SetCurrent 方法

定義

設定 CollectionView 目前的項目。

多載

SetCurrent(Object, Int32)

將指定的項目與索引設定為 CurrentItemCurrentPosition 屬性的值。

SetCurrent(Object, Int32, Int32)

將指定的項目與索引設定為 CurrentItemCurrentPosition 屬性的值。 這個方法可從衍生類別的建構函式呼叫。

SetCurrent(Object, Int32)

將指定的項目與索引設定為 CurrentItemCurrentPosition 屬性的值。

protected:
 void SetCurrent(System::Object ^ newItem, int newPosition);
protected void SetCurrent (object newItem, int newPosition);
member this.SetCurrent : obj * int -> unit
Protected Sub SetCurrent (newItem As Object, newPosition As Integer)

參數

newItem
Object

要設定為 CurrentItem 的項目。

newPosition
Int32

要設定為 CurrentPosition 屬性值的值。

適用於

SetCurrent(Object, Int32, Int32)

將指定的項目與索引設定為 CurrentItemCurrentPosition 屬性的值。 這個方法可從衍生類別的建構函式呼叫。

protected:
 void SetCurrent(System::Object ^ newItem, int newPosition, int count);
protected void SetCurrent (object newItem, int newPosition, int count);
member this.SetCurrent : obj * int * int -> unit
Protected Sub SetCurrent (newItem As Object, newPosition As Integer, count As Integer)

參數

newItem
Object

要設定為 CurrentItem 的項目。

newPosition
Int32

要設定為 CurrentPosition 屬性值的值。

count
Int32

CollectionView 中的項目數。

備註

從衍生類別的建構函式呼叫這個多載。 請勿傳遞 Count 屬性,這是虛擬屬性,做為 count 。 相反地,傳遞代表集合的內部 IList 計數。

SetCurrent.NET Framework 3.5 版引進。 如需詳細資訊,請參閱版本和相依性

適用於