BindingManagerBase.Position 속성

정의

파생 클래스에서 재정의되면, 이 데이터 소스에 바인딩된 컨트롤이 가리키는 내부 목록에서의 위치를 가져오거나 설정합니다.

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

속성 값

내부 목록에서 위치를 지정하는 0부터 시작하는 인덱스입니다.

예제

다음 코드 예제를 설정 하는 네 가지 메서드를 보여 줍니다는 Position 속성입니다. 메서드는 MoveNext 속성을 1씩 증분합니다. 메서드는 MovePrevious 속성을 1로 감소합니다. MoveFirst 메서드는 속성을 0으로 설정하고 메서드는 MoveLast 속성을 속성 값에서 1을 뺀 값 Count 으로 설정합니다.

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. 첫 번째 항목으로 이동하려면 를 0으로 설정합니다 Position . 목록의 끝으로 이동하려면 를 속성 값 Count 에서 1을 뺀 값으로 설정합니다Position.

속성 PositionChanged 값이 변경되면 Position 이벤트가 발생합니다.

적용 대상

추가 정보