private void AddTabs()
        {
            XDocument podcasts = XDocument.Load("Podcastlist.xml");

            XElement casts = podcasts.Element("podcasts");

            //List<XElement> castlist = new List<XElement>();
            IEnumerable<XElement> castlist = from pcs in casts.Elements("podcast").Descendants() select pcs;

            foreach (XElement cast in castlist)
            {
                XAttribute castName = cast.Attribute("name");
                XAttribute castID = cast.Attribute("id");
                XAttribute castURL = cast.Attribute("url");
                XAttribute castFavorite = cast.Attribute("favorite");

                ListBox lstBox = new ListBox();
                lstBox.Name = "listbox_" + castName;

                var posts = new RssFeedReader().ReadFeed(castURL.Value);
                int numofposts = posts.Count();

                foreach (var item in posts.ToList())
                {
                    TextBlock txtBlock = new TextBlock();
                    txtBlock.Text = item.Description;
                    txtBlock.TextWrapping = TextWrapping.Wrap;

                    Separator sep = new Separator();
                    sep.Margin = new Thickness(10, 0, 0, 0);
                    sep.Width = 500;

                    Label lbl = new Label();
                    lbl.Height = 0;
                    lbl.Visibility = Visibility.Hidden;
                    lbl.Content = item.URL;

                    Button btn = new Button();
                    btn.Name = "btnDownloadAndPlayFile_" + numofposts.ToString();
                    btn.Tag = item.URL;
                    btn.Click += new RoutedEventHandler(DownloadEpisode_Click);
                    btn.Content = "Download";

                    Expander exp = new Expander();
                    exp.Header = numofposts.ToString() + " - " + item.Title + "\n" + item.PublishedDate;
                    exp.Content = txtBlock;

                    StackPanel panelVertical = new StackPanel();
                    panelVertical.Children.Add(lbl);
                    panelVertical.Children.Add(btn);
                    panelVertical.Children.Add(exp);
                    panelVertical.Children.Add(sep);

                    lstBox.Items.Add(panelVertical);

                    numofposts--;
                }

                TabItem tabitem = new TabItem();
                tabitem.Content = lstBox;

                Podcastlist.Items.Add(tabitem);
            }
        }
        private void PopulateList()
        {
            var posts = new RssFeedReader().ReadFeed(@"http://www.pwop.com/feed.aspx?show=dotnetrocks&filetype=master");

            int numofposts = posts.Count();

            foreach (var item in posts.ToList())
            {
                TextBlock txtBlock = new TextBlock();
                txtBlock.Text = item.Description;
                txtBlock.TextWrapping = TextWrapping.Wrap;

                Separator sep = new Separator();
                sep.Margin = new Thickness(10, 0, 0, 0);
                sep.Width = 500;

                Label lbl = new Label();
                lbl.Height = 0;
                lbl.Visibility = Visibility.Hidden;
                lbl.Content = item.URL;

                Button btn = new Button();
                btn.Name = "btnDownloadAndPlayFile_" + numofposts.ToString();
                btn.Tag = item.URL;
                btn.Click += new RoutedEventHandler(DownloadEpisode_Click);
                btn.Content = "Download";

                Expander exp = new Expander();
                exp.Header = numofposts.ToString() + " - " + item.Title + "\n" + item.PublishedDate;
                exp.Content = txtBlock;

                StackPanel panelVertical = new StackPanel();
                panelVertical.Children.Add(lbl);
                panelVertical.Children.Add(btn);
                panelVertical.Children.Add(exp);
                panelVertical.Children.Add(sep);

                lstBoxAlpha.Items.Add(panelVertical);

                numofposts--;
            }
        }