The desired result looks like this: 
XAML: <StackPanel Name="SPName" Orientation="Horizontal"/> C#: mass = new Rectangle[100]; for (int i = 0; i < Mass.Length; i++) { mass[i] = new Rectangle(); mass[i].VerticalAlignment = VerticalAlignment.Bottom; mass[i].Width = SList.ActualWidth / Mass.Length; mass[i].Height = (SList.ActualHeight - 100) * (i / 100.0); mass[i].Fill = Brushes.Green; mass[i].StrokeThickness = 1; mass[i].Stroke = Brushes.Black; SPName.Children.Add(mass[i]); } When implemented through a ListBox, this results in: 
XAML: <ListBox ItemsSource="{Binding Mass}"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom"/> </ItemsPanelTemplate> </ListBox.ItemsPanel> </ListBox> C#: Panel parent = ((sender as Button).Parent as Panel).Parent as Panel; mass = new Rectangle[100]; for (int i = 0; i < Mass.Length; i++) { mass[i] = new Rectangle(); mass[i].VerticalAlignment = VerticalAlignment.Bottom; mass[i].Width = parent.ActualWidth / Mass.Length; mass[i].Height = (parent.ActualHeight - 100) * (i / 100.0); mass[i].Fill = Brushes.Green; mass[i].StrokeThickness = 1; mass[i].Stroke = Brushes.Black; } OnPropertyChanged("Mass"); How to implement the first option using ListBox?
