//------------------------------------------------------------------------------------ /// <summary> /// Will be called each time the store item bound to this rich text control changes. /// </summary> //------------------------------------------------------------------------------------ private static async void OnSourceStoreItemChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) { PlannerRichTextControl richTextControl = (PlannerRichTextControl)dependencyObject; RichTextBox richTextBox = richTextControl.PlannerRichTextBox; if (e.NewValue != null) { StoreItem storeItem = (StoreItem)e.NewValue; if (!richTextControl.m_documentLoading) { richTextControl.m_documentLoading = true; richTextBox.TextChanged -= richTextControl.PlannerRichTextBox_TextChanged; SetRichTextBoxText(richTextBox, "<Loading..>"); MemoryStream document = await storeItem.GetDocumentValueAsync(richTextControl.SourceStoreItemPropName); SetRichTextBoxDocument(richTextBox, document); richTextControl.PlannerRichTextBox.TextChanged += richTextControl.PlannerRichTextBox_TextChanged; richTextControl.m_documentLoading = false; } } }