I am trying to add some elements to the list that I added using the Xamarin.Forms markup in the xaml file. The key can be obtained by attaching it using the click event. But since listview is empty, I need an ondraw event like in ondraw , so that I can connect to it when it's drawn.

In the XAML file, I have:
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="ButtonXaml.ButtonXamlPage"> <StackLayout> <Button Text="Tap for click count!" BorderWidth="10" TextColor="Red" HorizontalOptions="Center" Clicked="OnButtonClicked" /> <ListView HorizontalOptions="Center" /> </StackLayout> </ContentPage>
In the .cs file I have
using System; using Xamarin.Forms; namespace ButtonXaml { public partial class ButtonXamlPage { int count = 0; public ButtonXamlPage() { InitializeComponent(); } public void OnButtonClicked(object sender, EventArgs args) { ((Button)sender).Text = "You clicked me"; } } }
So I have to connect to events in Listview or I can do something like Resource.getElementbyID , as in android
source share