StackPanel.Orientation Propriété

Définition

Obtient ou définit la dimension par laquelle les éléments enfants sont empilés.

public:
 property Orientation Orientation { Orientation get(); void set(Orientation value); };
Orientation Orientation();

void Orientation(Orientation value);
public Orientation Orientation { get; set; }
var orientation = stackPanel.orientation;
stackPanel.orientation = orientation;
Public Property Orientation As Orientation
<StackPanel Orientation="Horizontal"/>
-or-
<StackPanel Orientation="Vertical"/>

Valeur de propriété

Une des valeurs d’énumération qui spécifie l’orientation des éléments enfants. La valeur par défaut est Vertical.

Exemples

L’exemple suivant crée une liste horizontale d’éléments en définissant la propriété Orientation sur Horizontal.

<StackPanel Orientation="Horizontal" Margin="20">
    <Rectangle Fill="Red" Width="50" Height="50" Margin="5" />
    <Rectangle Fill="Blue" Width="50" Height="50" Margin="5" />
    <Rectangle Fill="Green" Width="50" Height="50" Margin="5" />
    <Rectangle Fill="Purple" Width="50" Height="50" Margin="5" />
</StackPanel>

S’applique à