Hi @Eduardo Gomez ,
Thanks for reaching out.
Based on the code you provided, the reason your button didn’t trigger the quantity picker is due to a few issues in your ViewModel and XAML:
- Typo in the command name Your ViewModel method was named
OenQuantityPopUp, but the generated command that the Button binds to isOpenQuantityPopUpCommand. Because of the typo, the command didn’t exist, so the Button had nothing to execute. - Passing the selected product Inside the
CollectionView, the Button needs to know whichProductit should act on. Your Picker binds toProduct.QuantityRangein the ViewModel, but without settingProductto the tapped item, it couldn’t show the correct quantity. - Reference to the popup You were using
{x:Reference CartPage}in your Button binding, but the rootSfPopuphad nox:Name, so the reference binding failed.
Fixes applied:
- Renamed the command method to
OpenQuantityPopUpand accepted aProductparameter:
[RelayCommand]
void OpenQuantityPopUp(Product product)
{
if (product is not null)
{
Product = product; // Set VM product to tapped item
}
IsSelectedQtyPopopOpened = true;
}
- Updated the Button binding in XAML to pass the tapped product:
<Button
Grid.Column="2"
BackgroundColor="Transparent"
Command="{Binding Source={x:Reference CartPage}, Path=BindingContext.OpenQuantityPopUpCommand}"
CommandParameter="{Binding .}"
FontAttributes="Bold"
FontSize="14"
Text="{x:Binding SelectedQuantity}" />
Hope this helps! If my answer was helpful - kindly follow the instructions here so others with the same problem can benefit as well.