DockPattern.DockPatternInformation.DockPosition DockPattern.DockPatternInformation.DockPosition DockPattern.DockPatternInformation.DockPosition DockPattern.DockPatternInformation.DockPosition Property

Définition

Récupère le DockPosition d'un AutomationElement dans un conteneur d'ancrage.Retrieves the DockPosition of an AutomationElement within a docking container.

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

Valeur de propriété

DockPosition de l'élément, par rapport aux limites du conteneur d'ancrage et des autres éléments présents dans le conteneur.The DockPosition of the element, relative to the boundaries of the docking container and other elements within the container.

Exemples

Dans l’exemple suivant, une DockPosition valeur est obtenue représentant la position d’ancrage actuelle d’un contrôle qui DockPatternprend en charge.In the following example, a DockPosition value is obtained representing the current dock position for a control that supports 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    

Remarques

Un conteneur d’ancrage est un contrôle qui permet la disposition des éléments enfants, à la fois horizontalement et verticalement, par rapport aux limites du conteneur d’ancrage et des autres éléments du conteneur.A docking container is a control that allows the arrangement of child elements, both horizontally and vertically, relative to the boundaries of the docking container and other elements within the container.

La valeur par défaut est None.The default value is None.

S’applique à