Presenter:Todd Miranda
Expression Blend provides an easy-to-use toolset to create XMLDataSources and use them to bind to controls. In this presentation Todd Miranda will demonstrate how to create and use an XMLDataSource in Expression Blend.
The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video
Minute 0
Fellow playlist on random and purposes presentation is to demonstrate how to use XML data sources and expression blend was began by creating a new project and martial Thracian buoyant will create a standard application and will call this XML data source object list again by creating some elements are windows we can use and will sport with the list box about a fault if your toolbar doesn t contain a list box you can click on the asset Library Aeros choose list box from the set of tools that are here
Minute 1
And it ll show up as an element in a list box so will select list box and will click and drag out a region for a list box to occupy it into a desolate more of a realistic snippet of an application will create a few buttons and will take those buttons and move them right over here and remember that we can use the allying tool so we can allying an ally left edges and have placed these weapons there are no we can name these buttons will call this
Minute 2
Bar right clicking and doing remain will call this button ad and then this button here will call button edit and nor should another name for no way to rename buttons inexpressibly and if you click on your property flame appear the name you can right click there and do the same thing and this will be delete so that we may not buttons will go down to our common properties section in the properties tab and the will and the content for our buttons so that her delete button and this is our edit button and this is our head but
Minute 3
So we can go to all of these buttons that will increase the font size a little bit further more easily readable and we can stretch them out to make them somewhat uniform and link okay so now we have our buttons and we have a list box so that we need to fill our list box with some items so let s give our list box a name they don t have to but this is just good practice to get into and will call this list box list of members and nail we need to create a data source in order to grab data popular list box 1 easier data sources to use in expression gland is the XML data source we can create a new XML data source by selecting the project
Minute 4
Tab in the going down to our data category window and you ll see them initially you ve got XML and CLR object with a little plus sign next to it that effectively means add an XML data source or had a CLR object bedsores were to add an XML data source will click on the plus XML button bully the connection name generic XML data source for now from select the browse button before you actually look for an XML file to use for data source I have an XML file called members that XML which contains a few fields for members of some covert organization that you might be using to create its evocation for it will do okay they ll are data window you see that we now have a members DES data source and then you can actually drill
Minute 5
Down into the XML hierarchically to see that we have members and then we have a member a ready so we have multiple member elements within our members element in each member element has three properties group color is active in name so let s now go towards animal before show you what this looks like incidental music is created for us and XML data provider with a key of members DS unit here this is the filename followed by capital DS for data source that you ll notice is the colon is data source the Dean namespace is registered here is an expression bouillon namespace services for expression bulletin to use for some of the functionality in the UI
Minute 6
And of course we have our source which is the path to our XML file says it is our XML data provider that we created the data source know what use it to populate our list box has two different ways that we can get to the way to populate our list box 1 of those is by going over to our objects and timeline We can right click on list box and we can choose blind items still works to data if we select that will see that we ve got data fields or properties if we wanted to bind to an element and an explicit data contexts which we have applied data context to this window so we can go into data field and with your data sources we have our members via status
Minute 7
Is so will select the members DS data source and to finish no notice the way it has populated the data into our list box officially a season is as one item and it s applied pretty much all of the elements altogether in one line at a single item and that s because we just simply chose the top level data source element to be the element that we bound to soliciting how we can change that and we ll look at the other way that we can affect the finding of our list box and that s by going to properties go down to the common properties category and an item source property here in this as holding little buttons to the right of the fields
Minute 8
Better in these windows go to the latest properties so this click on a button and we want to go down to data binding to the familiar this is a saying create data binding window that we get to if we right click on the element over objects and to use the binding option there such it is always hid the same window whichever you prefer so we have selected just the top level element the actual file so was drilled ale into our element if we chose members which is what effectively we cheered shows by just simply selecting the data source growing again one member item beautifully one member s element in our XML file under the member s element there s multiple member elements of the array of
Minute 9
Elements so will select that member array and to finish and see what I get since she is the year that now it has bound each member element into our list box but we have all the properties run together in our list box binding as because we simply by element to the member element so let s go back again to our data binding section and were combined to the member element work in a bind to the named element within the member or right and that s how we get to just the names of our members showed up in a list box so the school back again to our data binding window he is the one additional thing or point out is you don t see the other property here he is active property and that s because
Minute 10
Or show is for matching types only if we chose all properties we would this lead is active but because the system doesn t really is not really sure how you want to display a Boolean by selecting a matching types only those types that he knows exactly how to display without having to use any conversion so what s his name again as we have had before to show our names bound to her list boxes per list box items with code Project build project to build has successfully completed a stew test project and you can see that now we have our list box with our bound items coming from our XML file
Minute 11
The items were one of the members list in our list to say that it s fairly simple to create an XML data source to then find the elements in the XML data source to our list box using my self expression bland and if you want to look at his animal as opposed to just looking at the design view you ll see here for a list box element and item source is bound one way binding to the sore store members BS or number data source that was created in a referenced above and here is what we were playing with them we were selecting the particular part of the hierarchy to drill down to a source which elements to display in the list box items if we do
Minute 12
Members of needed before we would simply get the all the member elements shown all together in one line if we went down to the member level underneath members we would get all the properties out of groups together all shown together per member and lastly we drill down all the way to name and that s where we got this full express to drill all the way down to the name should do what we display our list box is just the name of our member note also here that is synchronized with current item is set to true that property for list box is also your common properties here and we can uncheck the box if we don t want to properties but usually you do if you want to keep your your list box I don t synchronize
Minute 13
The select a lot of cigarette for the current item in the view of all items are you showing so very simple to create a civil data sources and Marshall s expression bland ending years of actual data sources to buy two elements in a user effects
Click here to go to original video page
Tuesday, July 8, 2008
Video: CREATING AND USING AN XMLDATASOURCE
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment