다음을 통해 공유


DockPattern.DockPatternInformation.DockPosition 속성

정의

도킹 컨테이너 내에서 DockPositionAutomationElement을 검색합니다.

public:
 property System::Windows::Automation::DockPosition DockPosition { System::Windows::Automation::DockPosition get(); };
public System.Windows.Automation.DockPosition DockPosition { get; }
member this.DockPosition : System.Windows.Automation.DockPosition
Public ReadOnly Property DockPosition As DockPosition

속성 값

DockPosition

컨테이너 내에서 도킹 컨테이너 및 다른 요소의 경계를 기준으로 한 요소의 DockPosition입니다.

예제

다음 예제에서는 DockPosition 지 원하는 컨트롤에 대 한 현재 도킹 위치를 나타내는 값은 가져온 DockPattern합니다.

///--------------------------------------------------------------------
/// <summary>
/// Obtains a DockPattern control pattern from an 
/// automation element.
/// </summary>
/// <param name="targetControl">
/// The automation element of interest.
/// </param>
/// <returns>
/// A DockPattern object.
/// </returns>
///--------------------------------------------------------------------
private DockPattern GetDockPattern(
    AutomationElement targetControl)
{
    DockPattern dockPattern = null;

    try
    {
        dockPattern =
            targetControl.GetCurrentPattern(
            DockPattern.Pattern)
            as DockPattern;
    }
    // Object doesn't support the DockPattern control pattern
    catch (InvalidOperationException)
    {
        return null;
    }

    return dockPattern;
}
'''--------------------------------------------------------------------
''' <summary>
''' Obtains a DockPattern control pattern from an 
''' automation element.
''' </summary>
''' <param name="targetControl">
''' The automation element of interest.
''' </param>
''' <returns>
''' A DockPattern object.
''' </returns>
'''--------------------------------------------------------------------
Private Function GetDockPattern( _
ByVal targetControl As AutomationElement) As DockPattern
    Dim dockPattern As DockPattern = Nothing

    Try
        dockPattern = DirectCast( _
        targetControl.GetCurrentPattern(dockPattern.Pattern), _
        DockPattern)
    Catch exc As InvalidOperationException
        ' Object doesn't support the DockPattern control pattern
        Return Nothing
    End Try

    Return dockPattern

End Function 'GetDockPattern
///--------------------------------------------------------------------
/// <summary>
/// Gets the current view identifier from a target.
/// </summary>
/// <param name="dockPattern">
/// The control pattern of interest.
/// </param>
/// <returns>
/// The current dock position.
/// </returns>
///--------------------------------------------------------------------
private DockPosition GetCurrentDockPosition(
    DockPattern dockPattern)
{
    if (dockPattern == null)
    {
        throw new ArgumentNullException(
            "DockPattern parameter must not be null.");
    }

    return dockPattern.Current.DockPosition;
}
'''--------------------------------------------------------------------
''' <summary>
''' Gets the current view identifier from a target.
''' </summary>
''' <param name="dockPattern">
''' The control pattern of interest.
''' </param>
''' <returns>
''' The current dock position.
''' </returns>
'''--------------------------------------------------------------------
Private Overloads Function GetCurrentDockPosition( _
ByVal dockPattern As DockPattern) As DockPosition
    If dockPattern Is Nothing Then
        Throw New ArgumentNullException( _
        "DockPattern parameter must not be null.")
    End If

    Return dockPattern.Current.DockPosition

End Function 'GetCurrentDockPosition

설명

도킹 컨테이너는 허용 하는 컨트롤 자식 요소를 가로 또는 세로로 도킹 컨테이너 및 컨테이너 내에서 다른 요소의 경계를 기준으로 합니다.

기본값은 None입니다.

적용 대상