1
I have a contact list:
<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 take my contacts and store in it with the Contact class:
public class Contato
{
public object Foto { get; set; }
public string Nome { get; set; }
public string Telefone { get; set; }
}
So far is 100% functional, the app displays my contacts, but I want to do an action when some contact from the list is selected, 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 who was pressured, how do I do it?