I have a Xamarin.Forms PCL VS2015 Solution and have spent three days searching for a solution to my problem. I have tried numerous ways including using the Listview onitemselected which works fine for Win10 but not for Android or iOS. Tried this.FindByName(emailValue); and using the Sender Frame also but no luck. I need to provide the email address which is the label text binding.
<Label x:Name="emailValue"
Text="{Binding Email}"/>
The label is a child of a child of a listview item.
The x:Name element is not available in the code behind. I understand this is because the label is in a listview and the compiler would not be able to distinguish between the listview items.
I have drilled down using intellisense, on the sender of the Tap ( the Frame) and I can see the Email text that I need but I cant work out a way of extracting it.
<StackLayout Orientation="Vertical"
VerticalOptions="FillAndExpand">
<ListView x:Name="listViewContacts"
ItemSelected="OnListViewItemSelected"
IsPullToRefreshEnabled="true" Refreshing="OnRefresh"
SeparatorColor="#FFCF00"
VerticalOptions="FillAndExpand"
HasUnevenRows="True">
<!-- Need HasUnevenRows = true to enable correct
display in Android-->
<ListView.ItemTemplate>
<DataTemplate >
<ViewCell>
<ContentView Padding="5">
<StackLayout>
<Grid RowSpacing="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Frame OutlineColor="Black"
BackgroundColor="Transparent"
Padding="0"
Grid.Row="4">
<Frame.GestureRecognizers>
<TapGestureRecognizer Tapped="OnPhoneFrameTapped"/>
</Frame.GestureRecognizers>
<StackLayout Orientation="Horizontal"
Padding="10,5,0,5">
<Label Text="Phone:"/>
<Label x:Name="phoneValue"
Text="{Binding Mobile}"/>
</StackLayout>
</Frame> ...
!