İçerisine eklenen denetimleri yatayda (vertical) veya dikeyde (horizontal) hizalama yaparak gösterimini sağlar. Yön bilgisi “Orientation” özelliği ile belirlenir. Hizalanması gereken denetimler “<StackPanel>…<StackPanel/>” etiketleri arasına yerleştirilir.
Aşağıdaki örnekte StackPanel‘ e ait Orientation özelliğinin Vertical ve Horizantal olarak kullanılışı bulunmaktadır.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
<Window x:Class="stackpanel2.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="540"> <Grid Background="BurlyWood"> <StackPanel Orientation="Vertical" > <TextBox Text="www.yazilimkodlama.com" Width="150"/> <TextBox Text="www.yazilimkodlama.com" Width="150"/> <TextBox Text="www.yazilimkodlama.com" Width="150"/> <TextBox Text="www.yazilimkodlama.com" Width="150"/> </StackPanel> <StackPanel Orientation="Horizontal"> <Rectangle Width="90" Height="60" Fill="Red" /> <Rectangle Width="90" Height="60" Fill="Black" /> <Rectangle Width="90" Height="60" Fill="White" /> <Rectangle Width="90" Height="60" Fill="Red" /> <Rectangle Width="90" Height="60" Fill="Black" /> <Rectangle Width="90" Height="60" Fill="White" /> </StackPanel> </Grid> </Window> |