数据绑定和列表框问题 [英] Databinding and Listbox questions

查看:59
本文介绍了数据绑定和列表框问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我有一个绑定到列表框的XML文档数据。列表框中的每个项目都显示一个图像和2个文本字段。在列表框旁边,我在网格中有一个文本框。

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.

以下是我的问题:

1。如何使用文本框根据其中一个文本字段过滤列表框中的项目?

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

2。如何使列表框中的每个项目都可以拖动,以便我能够从列表框中拖动项目,并将其放入网格中。一旦丢入网格,它必须从列表框中删除? (组合(图像,文本字段,文本字段)项目,而不仅仅是一个文本字段)

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。当用户点击列表框中的某个项目时,应将相应的数据填充到数据网格中的各种控件中。

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.

 

在此先感谢您的帮助。

推荐答案

1。您将需要一个具有可以过滤的集合的数据模型,您的文本框也应该数据绑定到该模型,以便对搜索属性的更新可以正确过滤填充列表框的公开集合。

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。这个比较棘手,有可用的拖放行为,以及SLToolkit中的一些支持。

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

 

3。您可以绑定网格(或其他对象)的datacontext 在列表框的选定项目中,网格中的任何数据绑定都可以针对您在列表框中选择的对象完成。

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.


这篇关于数据绑定和列表框问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆