Reputation: 800
I am currently making a windows phone application for windows phone 8
.
I was wondering if there is a control or library which adds a control that allows you to show multiple items and have a button to increment or decrement next to each item.
for example
Item1 - 3 +
Item2 - 0 +
Any ideas or different ways to overcome/solve this would be appreciated
Upvotes: 0
Views: 76
Reputation: 303
Following on from my comment here is some code that should get you started. I'm not aware if you are using mvvm or code behind so I can't show how exactly the button actions would be hooked up but if you tell me I can expand upon this more.
<ListView ItemsSource="{Binding MyBinding}">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}"/>
<Button x:Name="Decrement" Content="-"/> // Hook this button up to an action
<TextBlock Text="{Binding Path=Number}"/>
<Button x:Name="Increment" Content="+"/> // Hook this button up another action
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Upvotes: 2