BindingManagerBase.Position Tulajdonság
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Ha egy származtatott osztályban felül van bírálva, lekéri vagy beállítja a mögöttes listában azt a pozíciót, amely az adatforrásponthoz kötött vezérlőket szabályozza.
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
Tulajdonság értéke
Nulla alapú index, amely az alapul szolgáló listában lévő pozíciót adja meg.
Példák
Az alábbi példakód négy metódust mutat be, amelyek beállítják a tulajdonságot Position . A MoveNext metódus 1-zel növeli a tulajdonságot. A MovePrevious metódus 1-gyel csökkenti a tulajdonságot. A MoveFirst metódus a tulajdonságot 0 értékre állítja, a MoveLast metódus pedig a tulajdonság értékét Count mínusz 1 értékre.
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
Megjegyzések
Position A tulajdonság használatával iterálhat a mögöttes listán, amelyet a BindingManagerBaserendszer a . Az első elemre való ugráshoz állítsa a Position 0 értéket. A lista végére lépéshez állítsa a Position tulajdonság értékét Count mínusz 1 értékre.
Az PositionChanged esemény akkor következik be, amikor a Position tulajdonság értéke megváltozik.