I have a listbox with multiple binded textblocks. Is there a way that I can get binding textblock data from the selected listboxitem to an other page as a string?
<ListBox Margin="0,10,-12,0" ItemsSource="{Binding Items}" Width="408" x:Name="ListBox1">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,17" Tap="StackPanel_Tap">
<!--Replace rectangle with image-->
<Rectangle Height="100" Width="100" Margin="12,0,9,0">
<Rectangle.Fill>
<ImageBrush ImageSource="{Binding LineImg}" x:Name="img"/>
</Rectangle.Fill>
</Rectangle>
<StackPanel Width="311">
<TextBlock x:Name="title" Text="{Binding LineOne}" TextWrapping="Wrap" FontSize="30"/>
<Line X1="0" Y1="0" X2="1" Y2="0" Stretch="Fill" Stroke="White" />
<TextBlock x:Name="time" Text="{Binding LineTwo}" Margin="0,0,12,10" Style="{StaticResource PhoneTextSubtleStyle}"/>
<Image Height="20" Width="20" Margin="-170,-45,0,0" Source="/PostDateIcon.png"/>
<TextBlock x:Name="date" Text="{Binding LineThree}" Margin="85,-37,12,10" Style="{StaticResource PhoneTextSubtleStyle}"/>
<TextBlock x:Name="content" Text="{Binding LineContent}" Visibility="Collapsed"/>
</StackPanel> </StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
I used this methode to load the binding data: http://kevinashley.com/connect-windows-phone-7-apps-to-wordpress-using-json/
you can try this:
var yourClassName = ListBox1.SelectedItem as YourClassType;
NavigationService.Navigate(new Uri(String.Format("/TargetPage.xaml?param={0}", yourClassName.LineOne), UriKind.Relative));
by this way,we can transition LineOne to your target page.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.