I can’t find a solution where when you press the “Plus” Button on the Home.xaml file,
it will create A StackLayout with 2 Text Labels in it (same as the StackLayout named “Texts1” Text on the Cart.xaml file) And it should be created inside the Specific StackLayout named “AddHere”
(Note: I am using Visual Studio 2022, .NET MAUI)
Home.xaml code:
<Button Text="+"
BackgroundColor="Green"
TextColor="White"
FontSize="Large"
HorizontalOptions="EndAndExpand"
VerticalOptions="Center"
Margin="-10,0"
Clicked="Increased1"/>
Cart.xaml code:
<StackLayout x:Name="AddHere">
<StackLayout Orientation="Horizontal"
IsVisible="False" x:Name="Texts1">
<Label Text="[FOOD NAME]"
HorizontalOptions="Start"
FontSize="Large"
TextColor="Black">
</Label>
<Label Text="[AMOUNT]"
HorizontalOptions="EndAndExpand"
VerticalOptions="CenterAndExpand"
FontSize="Small"
TextColor="Green">
</Label>
</StackLayout>
</StackLayout>
I’ve tried using Message Centers/Receivers, but realized that those are outdated.
I’ve also tried using ViewModels, but I honestly don’t know how to make it work with that.
What I’m expecting to happen: Basically when I press the button, it will create a stacklayout with 2 text labels inside of it, inside of a stacklayout.
Isaiah Josh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.