public static void SetBoundDocument(DependencyObject dp, FlowDocument value) { // I don't want to convert xaml to html now. I want to user flowdocument format directly. // For other platform, we will convert flowdocument to html on player side. // Set Directly #if _SAVE_CONTENT_AS_XAML_ FlowDocument document = value as FlowDocument; dp.SetValue(BoundDocument, HtmlFromXamlConverter.SerializeFlowDocument(document)); #else // Convert then set. var xaml = value; var html = HtmlFromXamlConverter.ConvertXamlToHtml(value); dp.SetValue(BoundDocument, html); #endif }
private void mainRTB_TextChanged(object sender, TextChangedEventArgs e) { lock (this.textChangedLocker) { string doc = HtmlFromXamlConverter.SerializeFlowDocument(this.mainRTB.Document);; var query = from part in this.Parts where !doc.Contains(part.PlaceHolder) select part; List <QuestionContentPart> tempList = new List <QuestionContentPart>(); foreach (var part in query) { tempList.Add(part); } foreach (var part in tempList) { this.Parts.Remove(part); } } }