/// <summary> /// Handles the mouse double click event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { // Get the item from the datacontext as a Result item, so we can access its values var item = ((FrameworkElement)e.OriginalSource).DataContext as Result; if (item == null) { return; } // Find the feed item window var feedItemWindow = new FeedItemWindow(); // Set the published date in the window var publishedDateLabel = (Label)feedItemWindow.FindName("itemPublishedDate"); if (publishedDateLabel != null) { publishedDateLabel.Content = item.publishedDate; } // Set the publisher name in the window var publisherLabel = (Label)feedItemWindow.FindName("itemPublisherLabel"); if (publisherLabel != null) { publisherLabel.Content = item.publisher; } // Set the title in the window var titleLabel = (Label)feedItemWindow.FindName("itemTitle"); if (titleLabel != null) { titleLabel.Content = Tools.StripTags(item.title.Replace("'", "'")); } // Set the content in the window var contentTextBlock = (TextBlock)feedItemWindow.FindName("itemContent"); if (contentTextBlock != null) { contentTextBlock.Text = Tools.StripTags(item.content.Replace("'", "'")); } // Set the news url in the window var urlButton = (Button)feedItemWindow.FindName("urlButton"); if (urlButton != null) { urlButton.CommandParameter = item.unescapedUrl; } // Set the related stories var relatedStoriesList = (ListView)feedItemWindow.FindName("relatedStories"); if (relatedStoriesList != null) { relatedStoriesList.ItemsSource = item.relatedStories; } // Show the window feedItemWindow.Show(); }