CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2011
    Posts
    3

    Question Make textblock show text according to listbox item

    Hello!

    I'm trying to make a listbox in C# (WP7 development) that will show text in a textblock according to which listbox item that has been selected.

    So basically, it's like this (an example I made up now):

    listBox1:
    Energy Drink
    Food

    textBlock1:
    (no text)


    However, I want to update the textBlock1 with "Energy Drink might not be good for your health" when the listbox item "Energy Drink" is selected, and then another text if the "Food" item is selected.

    I'm trying to do this with an "else IF", but it doesn't seem to be working, as no text is put into the textblock when an item is selected (in WP7 emulator mode).

    Anyone got any good ideas for this? I've been searching for a maniac for this, and I found the ListBox.SelectedItem property @ Microsoft, but I don't even get that to work (http://msdn.microsoft.com/en-us/libr...ecteditem.aspx).

  2. #2
    Join Date
    Oct 2011
    Posts
    3

    Re: Make textblock show text according to listbox item

    Alright, so I gave up on this and started using buttons instead, after a quick chat with a programmer from Microsoft, saying that that the listbox isn't much used anymore as it's not optimized for phones.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured