Hi Everyone! Today the main topic that is to be discussed is How to Parse XML or RSS in Expression Blend. Many of the viewers must be waiting for it. Well it simple that why before doing this we manage to discuss the how to create sample data. All the steps are same but you have to select different options in order to parse RSS feed and create a sample data.
How to Parse XML or RSS in Expression Blend:
- First of all create a new project and erase all the default stuff from MainPage.xaml and just add a simple Grid to it.
- After that open the project in blend by right clicking the project from Solution Explorer and clicking the option Open in Blend.
- By now your project would be open in blend.
- Open Bing or any of you default search engine and type there BBC RSS XML open the first link that is provided by Bing.
- Select which RSS feed you want to work with like in my case its RSS Feed that provides new of Asia (http://feeds.bbci.co.uk/news/world/asia/rss.xml).
- Copy this link to some where save because it would be utilized to get RSS Feeds from the BBC news channel.
- Well now move on the Data tab and click on Create Sample Data and this time select Import Sample Data from XML.
- Now here the link to RSS you saved earlier will come into play.
- When you have selected the above option then paste the XML/RSS like shown in the image.
- You will notice that the Data Source name would be added automatically but in some cases you would have to add by yourself.
- Now on the right below the Data tab you will see lots of things are imported.
- Yes this is because of the XML that we pasted earlier.
- Now Drag and Drop the ItemsCollections that is present below the Data Tab on the Grid.
- Now you will see something like this.
- Expand the Listbox on the whole grid.
- Now right click the Listbox, hover your mouse over Edit Additional Template, then hover your mouse over Edit Generated Items and then select Edit Current.
- Now first of all change the Layout of the Item template, change it from stack panel to Grid.
- Now you can change the setting of different textblock by going to their properties and peaking into different things.
- For example I have managed to change the color of the text and made the headline bold wrapped the text as shown in figure.
Download the Sample Data from here