C# Xaml How to get listbox selected item textbox value ?

I'm developing windows phone 8.1 app, and I need to get value of textboxes named:"time_tb" and "task_text_tb", that are in my selected item. This is my Xaml code:

 <ListBox x:Name="list" ItemsSource="{Binding tasks}" Background="White" Margin="-1,50,-1,63"> <ListBox.ItemTemplate> <DataTemplate> <Grid Margin="1" Height="76" Tapped="Grid_Tapped" Width="389"> <Grid.ColumnDefinitions> <ColumnDefinition Width="83*" /> <ColumnDefinition Width="307*" /> </Grid.ColumnDefinitions> <TextBox x:Name="time_tb" Margin="0,15,276,0" TextWrapping="Wrap" Text="{Binding time}" VerticalAlignment="Top" BorderBrush="#FF49B7DC" Width="83" Height="45" FontSize="18.667" Foreground="{x:Null}" Background="White" FontFamily="Segoe UI Emoji" IsReadOnly="True" TextAlignment="Center" HorizontalAlignment="Right" Grid.ColumnSpan="2"/> <Grid Grid.Column="1"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> </Grid.RowDefinitions> <TextBlock x:Name="task_text_tb" Margin="63,14,10,39.833" HorizontalAlignment="Stretch" TextWrapping="Wrap" Text="{Binding wht}" FontSize="16" SelectionHighlightColor="#FF1455B3" Grid.RowSpan="2" /> </Grid> </Grid> </DataTemplate> </ListBox.ItemTemplate> <StackPanel Height="100" Width="100"/> </ListBox> 

by ChiroV3 via /r/csharp

Leave a Reply