I have an ItemsControl where I display a long list of objects. I display it in a wrappanel so the user does not need to scroll. Now i want to add a Button at the end of the list, so the user can add new objects. What would be the best way to do this?
Here is my xaml:
<ItemsControl ItemsSource="{Binding Inventory}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel>
<Grid Width="300">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"/>
<ColumnDefinition/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Button Content="{Binding Name}"
MouseDoubleClick="CallEdit"/>
</Grid>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel MaxHeight="{Binding ElementName=window, Path=Height}"
Orientation="Vertical"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>