I'm really new to Xamarin.forms so pls be patient with me.
I try to give the user the chance to click on a button to create a new Button and initially the Button Name at the same time.
The user can create as many buttons as he wants, showed in a ScrollView. After he presses the button I want a little popup where he can enter the Name of the button.
void Mainpage_button_addNewButton_Clicked(object sender, EventArgs e)
{
var entry = new Namenseingabe();
Button button = new Button
{
//Text = entry.Name, Here i try to get the Value from the Entry
AutomationId = id.ToString(),
};
MainPageButtonStackLayout.Children.Add(button);
mainPageButtons.Add(button);
}
Here is the xaml from the Entry:
<StackLayout VerticalOptions="Center" HorizontalOptions="Center">
<StackLayout Orientation="Vertical" HeightRequest="200" WidthRequest="300" BackgroundColor="White">
<Entry x:Name="EntryValue" Margin="20,20,20,10" Placeholder="Name" Completed="EntryValue_Completed"></Entry>
<Button Margin="20,0,20,0" Text="Save"></Button>
</StackLayout>
</StackLayout>
</ContentView.Content>
I only get the value in the Method EntryValue_Completed() like here:
private void EntryValue_Completed(object sender, EventArgs e)
{
var a = ((Entry)sender).Text;
}
But how I can get the value in the method where I need it? Maybe you can help me with how I can do it better or faster.
