我有索姆列表框,我需要索姆幫助從x:Name =「ThisID」上的SelectionChanged獲取文本。SelectionChanged獲取文本塊文本/ ID
我已經做了類似(發件人爲列表框).SelectedItem但不止如此,我不知道該怎麼做。
<ListBox ItemsSource="{Binding}" x:Name="ListBoxD" SelectionChanged="ListBoxD_SelectionChanged" toolkit:TiltEffect.IsTiltEnabled="True" Margin="10,0,0,0">
<ListBox.ItemTemplate><DataTemplate>
<StackPanel Orientation="Horizontal" Margin="0,0,0,10">
<Border Width="80" Height="80" VerticalAlignment="Top" Background="{StaticResource PhoneAccentBrush}" Margin="0,5,0,0" Padding="5,0,5,10">
<TextBlock Text="{Binding DeliveryNumber}" Foreground="{StaticResource PhoneContrastBackgroundBrush}" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="72" />
</Border>
<StackPanel x:Name="StackPanelD" Orientation="Vertical" Margin="10,0,0,0">
<TextBlock x:Name="ThisID" Text="{Binding ID}" Visibility="Collapsed"/>
<TextBlock Text="{Binding Name}"/>
<TextBlock TextWrapping="Wrap" FontSize="23" FontWeight="Bold" Text="{Binding AddressLine}"/>
</StackPanel>
</StackPanel></DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
private void ListBoxDeliveryTo_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
NavigationService.Navigate(new Uri("/Page.xaml?ID=" + ID, UriKind.Relative));
}