Bind Collection to StackPanel

Alright I have figured it out… Using an ItemsControl solved the problem…

<ItemsControl x:Name="tStack" ItemsSource="{Binding Items}">
   <ItemsControl.ItemsPanel>
      <ItemsPanelTemplate>
         <StackPanel Orientation="Horizontal"/>
      </ItemsPanelTemplate>
   </ItemsControl.ItemsPanel>
   <ItemsControl.ItemTemplate>
      <DataTemplate>
         <Button Content="{Binding ItemName}"/>
      </DataTemplate>
   </ItemsControl.ItemTemplate>
</ItemsControl>

Leave a Comment

tech