locked
Windows store app - ListView items RRS feed

  • Question

  • Hello, i am making a list app.


    I have a ListView control on my page. and i will add the following code to the ListView dynamically in code behind.

    <StackPanel Orientation="Horizontal">
    
    <textbox  />
    
    <button Content="Save"/>
    
    
    </StackPanel>

    Since this will be added dynamically , i cannot give the textbox(es) in the ListView a name, that i can reference them by.

    So when the user presses save for any of the textbox(es) in the ListView. How do i found out which textbox Text the user is trying to save?

    Keep in mind, sometimes there might be 1 item in the ListView or 10 or 100.

    Monday, July 14, 2014 5:39 AM

Answers

  • Here's a video I did explaining how you can get and keep references to dynamically loaded controls within an itemscontainer:

    http://channel9.msdn.com/Series/Windows-Store-Developer-Solutions/Playing-Hide-and-Go-Seek-with-DataTemplated-Controls


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by kalel111 Friday, July 18, 2014 3:57 AM
    Monday, July 14, 2014 12:47 PM
    Moderator