I have a richtextbox in my wpf application and I am adding videos to it by using mediaelement. Then I convert flowdocument to xaml and store it to database. When I fetch xaml from database and convert it back to flowdocument and click play button, I can hear audio but cannot see video. Loadedbehavior is set to Manual.
Strange part is when I set loadedbehavior to Play, I can see video.
P.S. I am not good at english. so please forgive me for that.
Following is the XAML AND Source:
<RichTextBox
Width="779"
Height="200"
IsDocumentEnabled="True">
<FlowDocument c:FlowDocumentBehavior.DocumentResourceName="inlineTemplate" c:FlowDocumentBehavior.DocumentSource="{Binding VignetteTextXaml}"></FlowDocument>
</RichTextBox>
Following is the code where I convert xaml string to flowdocument:
FlowDocument doc = d as FlowDocument;
RichTextBox rtb = doc.Parent as RichTextBox;
string xamlString = FlowDocumentBehavior.GetDocumentSource(doc);
string templateName = FlowDocumentBehavior.GetDocumentResourceName(doc);
if (xamlString != null && templateName != null)
{
StringReader stringReader = new StringReader(xamlString);
XmlReader xmlReader = XmlReader.Create(stringReader);
if (!string.IsNullOrWhiteSpace(xamlString))
{
doc = (FlowDocument)XamlReader.Parse(xamlString);
rtb.Document = doc;
rtb.IsDocumentEnabled = true;
}
}
Only audio works but no video. :(
Thank you in advance.