BindingManagerBase.Position BindingManagerBase.Position BindingManagerBase.Position BindingManagerBase.Position Property

Definição

Quando substituído em uma classe derivada, obtém ou define a posição na lista subjacente para a qual os controles associados a essa fonte de dados apontam.When overridden in a derived class, gets or sets the position in the underlying list that controls bound to this data source point to.

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

Valor da propriedade

Um índice baseado em zero que especifica uma posição na lista subjacente.A zero-based index that specifies a position in the underlying list.

Exemplos

O exemplo de código a seguir mostra quatro métodos que Position definem a propriedade.The following code example shows four methods that set the Position property. O MoveNext método incrementa a propriedade em 1.The MoveNext method increments the property by 1. O MovePrevious método decrementa a propriedade em 1.The MovePrevious method decrements the property by 1. O MoveFirst método define a propriedade como 0 e o MoveLast método define a propriedade Count como o valor da propriedade menos 1.The MoveFirst method sets the property to 0, and the MoveLast method sets the property to the value of the Count property minus 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

Comentários

Use a Position propriedade para iterar pela lista subjacente mantida BindingManagerBasepelo.Use the Position property to iterate through the underlying list maintained by the BindingManagerBase. Para ir para o primeiro item, defina Position como 0.To go to the first item, set the Position to 0. Para ir até o final da lista, defina o Position como o valor Count da propriedade menos 1.To go to the end of the list, set the Position to the value of the Count property minus 1.

O PositionChanged evento ocorre quando o Position valor da propriedade é alterado.The PositionChanged event occurs when the Position property value changes.

Aplica-se a

Veja também