Advertisement
lseidman

ListBox Content Grab

Apr 17th, 2012
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. XAML CONTENT
  2.  
  3. Just ListBox w/TextBlock Example:
  4. ----------------------------------
  5. <ListBox x:Name="results" Margin="0,93,0,-22" FontFamily="Tahoma">
  6.     <ListBox.ItemTemplate>
  7.         <DataTemplate>
  8.             <TextBlock Style="{StaticResource PhoneTextLargeStyle}" Text="{Binding Name}" Tap="Phone_Tap" />
  9.         </DataTemplate>
  10.     </ListBox.ItemTemplate>
  11. </ListBox>
  12.  
  13. XAML.CS CONTENT
  14.  
  15.         private void Phone_Tap(object sender, System.Windows.Input.GestureEventArgs e)
  16.         {
  17.           MessageBox.Show(lstBox.SelectedItem.ToString());
  18.         }
  19. Note: Result: Project Name + Result aka failed to grab binding.
  20.  
  21. I also tried Example #5 on:
  22. http://www.windowsphonegeek.com/tips/wp7-contextmenu-answers-to-popular-questions
  23.  
  24. I just can't seem to get the item to a string...
  25.  
  26. Any help, very welcomed!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement