Olá,
eu estou criando um app pra lanchonete, e agora estou com duvida em como pegar o contexto usando a açao do botao.
Eu quero que quando o botao "AddCarrinhoCommand" seja acionado, eu consiga pegar o valor do stepper e o preço pra poder jogar no pedido.
<ListView x:Name="listViewProdutos"
ItemsSource="{Binding Produtos}"
IsPullToRefreshEnabled="True"
RefreshCommand="{Binding RefreshCommand}"
IsRefreshing="{Binding IsRefreshing, Mode=OneWay}"
Margin="0,10,0,15"
HasUnevenRows="true"
>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout Orientation="Horizontal" Padding="15,10" Margin="0,3" BackgroundColor="#ffffff">
<Image Source="{Binding img, Mode=TwoWay}" Aspect="AspectFill" HeightRequest="50" WidthRequest="80" Margin="0,0,10,0" />
<StackLayout Orientation="Vertical">
<StackLayout Orientation="Horizontal">
<Label Text="{Binding produto}" FontSize="22" VerticalTextAlignment="Center" TextColor="#006699"></Label>
<Label Text="{Binding preco, StringFormat='R$ {0}'}" FontSize="20" FontAttributes="Bold" VerticalTextAlignment="Center" HorizontalTextAlignment="End" TextColor="#f78f2b"></Label>
</StackLayout>
<StackLayout Orientation="Horizontal">
<Label Text="{Binding Source={x:Reference quantidade}, Path=Value, StringFormat='Qt:{0}'}" FontSize="20" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" />
<Stepper Minimum="0" Increment="1" Value="{Binding quantidade, Mode=TwoWay}" x:Name="quantidade" />
</StackLayout>
<Button VerticalOptions="End" BackgroundColor="#add091" Image="mais.png" Command="{Binding AddCarrinhoCommand}"></Button>
</StackLayout>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>