BindingManagerBase.Position 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
當在派生類別中被覆寫時,會取得或設定綁定到該資料來源所指向的底層清單中的位置。
public:
abstract property int Position { int get(); void set(int value); };
public abstract int Position { get; set; }
member this.Position : int with get, set
Public MustOverride Property Position As Integer
屬性值
一個以零為基礎的索引,用來指定底層列表中的某一位置。
範例
以下程式碼範例展示了四個設定該 Position 屬性的方法。 此 MoveNext 方法將屬性增加1。 此 MovePrevious 方法將性質減少1。 該 MoveFirst 方法將性質設為 0, MoveLast 而該方法則將性質設定為該性質的 Count 值減 1。
private:
void BindingManagerBase_CurrentChanged( Object^ sender, EventArgs^ /*e*/ )
{
// Print the new value of the current object.
Console::Write( "Current Changed: " );
Console::WriteLine( ( (BindingManagerBase^)(sender) )->Current );
}
void MoveNext()
{
// Increment the Position property value by one.
myBindingManagerBase->Position = myBindingManagerBase->Position + 1;
}
void MovePrevious()
{
// Decrement the Position property value by one.
myBindingManagerBase->Position = myBindingManagerBase->Position - 1;
}
void MoveFirst()
{
// Go to the first item in the list.
myBindingManagerBase->Position = 0;
}
void MoveLast()
{
// Go to the last row in the list.
myBindingManagerBase->Position = myBindingManagerBase->Count - 1;
}
private void BindingManagerBase_CurrentChanged
(object sender, EventArgs e)
{
// Print the new value of the current object.
Console.Write("Current Changed: ");
Console.WriteLine(((BindingManagerBase)sender).Current);
}
private void MoveNext()
{
// Increment the Position property value by one.
myBindingManagerBase.Position += 1;
}
private void MovePrevious()
{
// Decrement the Position property value by one.
myBindingManagerBase.Position -= 1;
}
private void MoveFirst()
{
// Go to the first item in the list.
myBindingManagerBase.Position = 0;
}
private void MoveLast()
{
// Go to the last row in the list.
myBindingManagerBase.Position =
myBindingManagerBase.Count - 1;
}
Private Sub BindingManagerBase_CurrentChanged(sender As Object, e As EventArgs)
' Print the new value of the current object.
Console.Write("Current Changed: ")
Console.WriteLine(CType(sender, BindingManagerBase).Current)
End Sub
Private Sub MoveNext()
' Increment the Position property value by one.
myBindingManagerBase.Position += 1
End Sub
Private Sub MovePrevious()
' Decrement the Position property value by one.
myBindingManagerBase.Position -= 1
End Sub
Private Sub MoveFirst()
' Go to the first item in the list.
myBindingManagerBase.Position = 0
End Sub
Private Sub MoveLast()
' Go to the last row in the list.
myBindingManagerBase.Position = myBindingManagerBase.Count - 1
End Sub
備註
利用該 Position 屬性遍歷由 BindingManagerBase維護的底層清單。 要進入第一個項目,請將 設 Position 為 0。 要進入清單的末尾,將 設定 Position 為該屬性的值 Count 減 1。
當房產價值變動時Position,事件PositionChanged就會發生。