I have a list of contacts:
<ListBox Name="lstContatos">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Image Tap="txtTelefone_Tap" Width="45" VerticalAlignment="Center"
Name="imgFoto"
Source="{Binding Foto}" />
<TextBlock Tap="txtTelefone_Tap" Name="txtNome" Height="Auto"
FontSize="28"
VerticalAlignment="Center"
Margin="4,0,0,0"
Text="{Binding Nome}" />
</StackPanel>
<TextBlock x:Name="tel" Tap="txtTelefone_Tap" Height="Auto"
Margin="48,0,0,0" HorizontalAlignment="Left"
FontSize="22" Foreground="{StaticResource PhoneAccentBrush}"
FontWeight="Bold"
Width="Auto" Text="{Binding Telefone}"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
I get my contacts and store them in the Contact class:
public class Contato
{
public object Foto { get; set; }
public string Nome { get; set; }
public string Telefone { get; set; }
}
So far it's 100% functional, the app displays my contacts, however I want to do an action when some contact from the list is selected, I tried using:
private void txtTelefone_Tap(object sender, System.Windows.Input.GestureEventArgs e)
{
foreach (Contato s in dados)
{
num.Text = numero = s.Telefone;
}
myPivot.SelectedIndex = 1;
}
The goal is to get the number of that contact that was pressed, how do I do that?