1

wpfアプリケーションにrichtextboxがあり、mediaelementを使用してそれにビデオを追加しています。次に、flowdocumentをxamlに変換し、データベースに保存します。データベースからxamlをフェッチし、それをflowdocumentに変換して再生ボタンをクリックすると、オーディオは聞こえますが、ビデオは表示されません。LoadedbehaviorはManualに設定されています。

奇妙な部分は、loadedbehaviorをPlayに設定すると、ビデオが表示されることです。

PS私は英語が苦手です。許してください。

XAMLANDソースは次のとおりです。

  <RichTextBox 
    Width="779"
    Height="200"
    IsDocumentEnabled="True">
    <FlowDocument c:FlowDocumentBehavior.DocumentResourceName="inlineTemplate" c:FlowDocumentBehavior.DocumentSource="{Binding VignetteTextXaml}"></FlowDocument>
    </RichTextBox>

以下は、xaml文字列を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;
            }
        }

オーディオのみが機能し、ビデオは機能しません。:(

前もって感謝します。

4

0 に答える 0