I need to have selection changed event inside a listbox itemtemplate. My listbox consists of three textblocks and an image. I want to get the third text block text only and when I select the third textblock the text in the text block will appear as a popup.
I used the visual tree to search for a textblock but it take the value of first text block instead of third textblock. What can i do to get the value of 2nd and 3rd textblocks. And I need to trigger a popup only when I click the textblock in the listbox not the whole listbox item.
<ListBox Name="listBox1" Width="Auto" SelectionChanged="Listbox1_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<Image Height="165" HorizontalAlignment="Left" Margin="10,40,-400,0" VerticalAlignment="Top" Width="175" Source="{Binding thumb}"/>
<TextBlock Name="pagetext" TextWrapping="Wrap" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="195,-135,-200,0" Text="{Binding page}" Foreground="#FF170101" />
<TextBlock Name="titletext" Width="1000" TextWrapping="NoWrap" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="195,-167,-200,0" Text="{Binding title}" Foreground="#FF170101" />
<TextBlock Name="text" Width="1000" TextWrapping="NoWrap" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="195,-167,-200,0" Text="{Binding title}" Foreground="#FF170101" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
use TextBlock_MouseLeftButtonUp or TextBlock_Tap(this is rise when click on textblock)
In this,
the above string s disply where you want.