private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) { if (this.Visibility == Visibility.Visible) { // Reset the filter StoryFilterTextBox.Text = string.Empty; StorysListBox.FilterList(StoryFilterTextBox.Text); // Show the story, hide the editor StoryViewBorder.Visibility = Visibility.Visible; StoryEditBorder.Visibility = Visibility.Hidden; // Load the person story into the viewer LoadStoryText(StoryView.Document); // Display all text in constrast color to the StoryViewer background. TextRange textRange = new TextRange(StoryView.Document.ContentStart, StoryView.Document.ContentEnd); textRange.Select(StoryView.Document.ContentStart, StoryView.Document.ContentEnd); textRange.ApplyPropertyValue(TextElement.ForegroundProperty, FindResource("FlowDocumentFontColor")); // Workaround to get the StoryViewer to display the first page instead of the last page when first loaded StoryView.ViewingMode = FlowDocumentReaderViewingMode.Scroll; StoryView.ViewingMode = FlowDocumentReaderViewingMode.Page; } }
private void FilterTextBox_TextChanged(object sender, TextChangedEventArgs e) { StorysListBox.FilterList(StoryFilterTextBox.Text); }