How SelectedItem Works

Thread is closed for posting
2 posts, 0 answers
  1. Michael
    Michael avatar
    4 posts
    Member since:
    May 2014

    Posted 31 Oct 2014 Link to this post

    I have 3 items in a DataBoundListBox in a datatemplate stack panel

     <Button x:Name="myButton"  />
    <TextBlock x:Name="myTxt" />
    <TextBlock x:Name="myTxt2" />

    How do I get the value of, for example the myTxt2 text block of the selected item?
  2. Rosy Topchiyska
    Rosy Topchiyska avatar
    586 posts

    Posted 03 Nov 2014 Link to this post

    Hello Michael,

    Thank you for contacting us.

    If you bind the TextBlock.Text property to a property from your data class, then using the SelectionChanged event, you can get the selected data item and the property that you are interested in. I have attached a sample project for demonstration.

    I hope this helps.  

    Rosy Topchiyska

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top