locked
Databinding and Listbox questions RRS feed

  • Question

  • Hi

    I have an XML document data binded to a listbox. Each item in the listbox displays an image, and 2 text fields. Next to the listbox, I have a textbox inside a grid.

    Here are my questions:

    1. How can I use the textbox to filter the items in the listbox based on one of the text fields?

    2. How can I make each item within the listbox dragable so that I would be able to drag an item from the listbox, and drop it into the grid. Once dropped inside the grid, it must be removed from the listbox? (the combined(Image, text field, text field) item, not only one text field)

    3. When a user clicks on one of the items in the listbox, the appropriate data should be populated into various controls within the datagrid.

     

    Thanks in advance for any help.

    Wednesday, April 7, 2010 2:20 PM

All replies

  • 1. You will need a datamodel that has a collection exposed that can be filtered, your textbox should also be databound to that model, so that updates to the search property properly filter the exposed collection that populates the listbox.

     

    2. This one is trickier, there are drag + drop behaviors available, as well as some support in the SLToolkit.

     

    3. You can bind the datacontext of the grid (or other object)  to the selected item of the listbox, that way any databinding in the grid can be done against the object you have selected in the listbox.

    Wednesday, April 7, 2010 5:27 PM
    Moderator