I put the stepper on listview so each record has one stepper. I would like to bind the stepper onchanged value to one of the corresponding objects parameter value. So each listed records' parameter can be altered by corresponding stepper. Is it possible to do so? Here is the ListView:
<ListView x:Name="TempMenuListView" HasUnevenRows="true" Grid.Row="2" SeparatorColor="Black" >
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Padding="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Label Text="{Binding PiattoTipo}" Grid.Row="0" Grid.Column="0" TextColor="Black" />
<Label Text="{Binding Piatto}" Grid.Row="0" Grid.Column="1" TextColor="Black" />
<Label x:Name="numeroPiattiLabel" Text="{Binding NumeroPiatti}" Grid.Row="0" Grid.Column="2" TextColor="Black" />
<Stepper x:Name="stepper" Maximum="20" ValueChanged="OnStepperValueChanged"/>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Here is the class for ListView Data:
[Table("TempMenu")]
public class TempMenu
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public DateTime Date { get; set; }
public int TavoloNo { get; set; }
public string PiattoTipo { get; set; }
public string Piatto { get; set; }
public int NumeroPiatti { get; set; }
}
An empty OnStepperValueChanged method:
private void OnStepperValueChanged(object sender, ValueChangedEventArgs e)
{
}
I need the stepper to change respectable NumeroPiatti
value.