This is a new Version of my old RSS Widget Article. As you will see it has the feature of data persistence using ISO Storage.
Creating the Silverlight Project
We will create a simple Silverlight Project and name it as RSSFeedWidget2.
Figure 1.1 Creating Silverlight Project
Designing our Sample Application
I have used Blend 3 to design our simple application. I have kept one TextBox where the user can paste the RSS Feed URL and two buttons, one for search feed data and the other one for adding the URL into persistence (ISO Storage). I have used three png images to accomplish my design.
Figure 1.2 Designing the Application
Checking for RSS URL in Persistence
When the User control will be loaded, it will check the availability of the key and if present it would display the RSS Data, Otherwise it would give exception as no key found. The following code will achieve our goal.
private void UserControl_Loaded(object sender, RoutedEventArgs e)
MyRSSList myList = (MyRSSList)appSettings["RSSFeedURL"];
txtUrl.Text = myList.RssURL;
Uri.TryCreate(txtUrl.Text, UriKind.Absolute, out feedUri);
#region URI Validations
if (feedUri == null)
if (txtUrl.Text == "")
txtStatus.Text = "*URL Field should not empty";
txtStatus.Text = "*Invalid RSS feed URL";
txtStatus.Text = "RSS Feed Loaded Successfully";
catch (System.Collections.Generic.KeyNotFoundException ex)
txtStatus.Text = ex.Message;
Adding a new RSS and Adding it to Persistence
Adding a new RSS Feed URL is as simple as that, copy the URL (Note: Those Web Servers without having ClientAccessPolicy.xml are not valid RSS Feed URL for Silverlight)and then paste it in the TextBox and click the Search button.
To add an URL to the Persistence you need to click the add button and a new pop up will be displayed.
Figure 1.3 Adding the URL to the Persistence.
To add the URL into Persistence, you need to press ok and a new text field will be displayed which will carry the URL Title. The following figure shows it.
Figure 1.4 RSS Feed Title
Then press Save & Exit and your url is saved into persistence. Now when you re-run the application you can get the RSS Feed data from the persistence.
Here is the code for adding a key to ISO Storage.
public partial class AddRssUrl : ChildWindow
private IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;
private void OKButton_Click(object sender, RoutedEventArgs e)
OKButton.Visibility = Visibility.Collapsed;
txtBlockTitle.Visibility = Visibility.Visible;
txtFeedTitle.Visibility = Visibility.Visible;
btnSaveExit.Visibility = Visibility.Visible;
private void CancelButton_Click(object sender, RoutedEventArgs e)
this.DialogResult = false;
private void btnSaveExit_Click(object sender, RoutedEventArgs e)
MyRSSList myList = new MyRSSList();
myList.Title = txtFeedTitle.Text;
myList.RssURL = txtAddURL.Text;
appSettings["RSSFeedURL"] = myList;
this.DialogResult = true;
First we are removing a key that is pre existed. And then we are adding the key.
Running the Application
When you run the Application it will look like the following.
So this is another widget in my series, hope you like it. Enjoy Coding.