Question
jandro935 on Fri, 21 Feb 2014 06:22:59
Main Page .xaml <!--ContentPanel. Colocar aquí el contenido adicional--> <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <ListBox x:Name="lstLista" SelectionChanged="lstLista_SelectionChanged"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=Nombre}" Style="{StaticResource PhoneTextLargeStyle}"></TextBlock> <!--<TextBlock Text="{Binding Path=correo}" Style="{StaticResource PhoneTextSubtleStyle}"></TextBlock> <TextBlock Text="{Binding Path=telefono}" Style="{StaticResource PhoneTextSubtleStyle}"></TextBlock>--> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Main Page .c# // Constructor public MainPage() { InitializeComponent(); ObservableCollection<Agenda> lista = new ObservableCollection<Agenda>(); lista.Add(new Agenda { Nombre = "Ana", correo = "ana@gmail.com", telefono = "616-25-65-69" }); lista.Add(new Agenda { Nombre = "Francisco", correo = "francisco@gmail.com", telefono = "626-23-64-19" }); lista.Add(new Agenda { Nombre = "Manuel", correo = "manuel@gmail.com", telefono = "666-24-65-69" }); lista.Add(new Agenda { Nombre = "Verónica", correo = "veronica@gmail.com", telefono = "699-45-66-70" }); lstLista.ItemsSource = lista; } private void lstLista_SelectionChanged(object sender, SelectionChangedEventArgs e) { NavigationService.Navigate(new Uri("/PaginaDetalle.xaml", UriKind.Relative)); } protected override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e) { base.OnNavigatedFrom(e); PaginaDetalle p = e.Content as PaginaDetalle; if (p != null) { p.DataContext = lstLista.SelectedItem; } } Pagina detalle .xaml <!--ContentPanel. Colocar aquí el contenido adicional--> <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <StackPanel> <TextBlock Text="{Binding Path=Nombre}" Style="{StaticResource PhoneTextLargeStyle}"></TextBlock> <TextBlock Text="{Binding Path=correo}" Style="{StaticResource PhoneTextSubtleStyle}"></TextBlock> <TextBlock Text="{Binding Path=telefono}" Style="{StaticResource PhoneTextSubtleStyle}"></TextBlock> </StackPanel> </Grid>
Replies
Kulasangar on Fri, 21 Feb 2014 06:29:32
What's the problem you're having?
jandro935 on Fri, 21 Feb 2014 06:33:18
Detalle c# private void cmdllamar_Click(object sender, RoutedEventArgs e) { PhoneCallTask phoneCallTask = new PhoneCallTask() { DisplayName = ((Agenda) this.DataContext).Nombre. PhoneNumber = ((Agenda) this.DataContext).telefono }; phoneCallTask.Show(); } private void cmdEnviarCorreo_Click(object sender, RoutedEventArgs e) { EmailComposeTask email = new EmailComposeTask() { To = ((Agenda)this.DataContext).correo, Subject = "Nuevo" }; }