Now the Data Template dialog comes up. The first thing to look at over on the right is the preview. Right now, if I were to click OK, I would see all of these fields for each one of my products. This is not what I want. So over in the date of template field, I can see the different properties. I could if I needed to select one of the properties and use the upper down buttons to rearrange their order and you could see the image changing its position in the preview.
In this case however, the only field I am really interested in is the name. So, I am going to unchecked the other fields, so my list box only contains the name. To the right of the name, it shows that it is going to create a text block to represent my name. If I wanted to, I can expand that to tell blend to use an image or label or even controls like a button to display that property. I am satisfied with the text box, so I am going to leave it as is.
I am going to press OK, and now my list box is populated with the names of different products that I have. When I press F5 to run my project, you will see that I have got a list box and I can click and select anyone of those products.
Now, let us get the rest of the information. In order to bind the rest of the information, the easiest way to do it is to create a layout container and bind the date of contacts of that layout container to the selective item. I am going to choose a grid and I am going to add a grid to my project. I am going to double-click my grid to make it the activated element so that everything I add from here all out becomes the child of that grid.
In the Properties Inspector, I am going to bind the data contacts of my grid to the selected element of the list box. Now, what does this mean? The date of contacts for layout container means that, that layout container is associated with a single piece of data. In this case, I am binding the data contacts to the specific product that the user has selected in the list box on the left. I could use my property marker and choose data binding.
The data binding dialog comes up and this is the first time we have seen it. So I want to explain a few things. At the top, there are three tabs, date of field, element property and explicit data contacts. Data field would allow us to bind to a data source but since we have already bound the list box to a data source, this is not the field I am looking for. The element property allows me to bind one of my properties to match one of the other properties.
We are going to use the element property right now. The left field scene element shows me the tree that if you look matches what I see in the object tree in the main application. I am going to choose my list box and now in the right field are the properties on the list box. When I scroll down on that list, I will eventually find selected item. Now, when I pressed finish, the data contacts from my grid are associated with the selected items in the list box.
Now, since the grid does not display anything itself. This is not too useful but let us create a control inside the grid to display our data.
Transcription by:
Scribe4you Transcription Services